public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests/backtrace.c (frame_callback): Error on seeing more than 16 frames.
@ 2014-06-15  9:37 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-06-15  9:37 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

Don't fill up the test logs with obviously bogus frames.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 tests/ChangeLog   | 4 ++++
 tests/backtrace.c | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index cd8a8e7..5fa8b15 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-15  Mark Wielaard  <mjw@redhat.com>
+
+	* backtrace.c (frame_callback): Error on seeing more than 16 frames.
+
 2014-06-11  Mark Wielaard  <mjw@redhat.com>
 
 	* backtrace.c (main): Check that Dwfl was attached by calling
diff --git a/tests/backtrace.c b/tests/backtrace.c
index ce0bd17..aae344c 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -147,6 +147,13 @@ frame_callback (Dwfl_Frame *state, void *frame_arg)
   int *framenop = frame_arg;
   Dwarf_Addr pc;
   bool isactivation;
+
+  if (*framenop > 16)
+    {
+      error (0, 0, "Too many frames: %d\n", *framenop);
+      return DWARF_CB_ABORT;
+    }
+
   if (! dwfl_frame_pc (state, &pc, &isactivation))
     {
       error (0, 0, "%s", dwfl_errmsg (-1));
-- 
1.9.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-15  9:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15  9:37 [PATCH] tests/backtrace.c (frame_callback): Error on seeing more than 16 frames Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).