From d5dff793af80b6534e9fb2e4f0301993bd209a4f Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Sat, 15 Aug 2015 11:42:43 -0700 Subject: Fix BZ #18084 -- backtrace (..., 0) dumps core on x86. Other architectures also had bugs, or did unnecessary work. --- sysdeps/arm/backtrace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sysdeps/arm') diff --git a/sysdeps/arm/backtrace.c b/sysdeps/arm/backtrace.c index 7ab487c2fc..5a30c209ff 100644 --- a/sysdeps/arm/backtrace.c +++ b/sysdeps/arm/backtrace.c @@ -92,6 +92,10 @@ __backtrace (array, size) int size; { struct trace_arg arg = { .array = array, .size = size, .cnt = -1 }; + + if (size <= 0) + return 0; + #ifdef SHARED __libc_once_define (static, once); @@ -100,8 +104,7 @@ __backtrace (array, size) return 0; #endif - if (size >= 1) - unwind_backtrace (backtrace_helper, &arg); + unwind_backtrace (backtrace_helper, &arg); if (arg.cnt > 1 && arg.array[arg.cnt - 1] == NULL) --arg.cnt; -- cgit 1.4.1