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>
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 1d3948e..331ba0f 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -148,6 +148,13 @@
   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));