This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] tests/backtrace.c (frame_callback): Error on seeing more than 16 frames.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]