diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-08-15 11:42:43 -0700 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-08-15 11:42:43 -0700 |
commit | d5dff793af80b6534e9fb2e4f0301993bd209a4f (patch) | |
tree | c3df534ffb1c966cb96ac71fee5cc0c4f17d3d57 /sysdeps/x86_64 | |
parent | 3cda1b6d56335a101ec3de0053248f68f010eee1 (diff) | |
download | glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.zip glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.tar.gz glibc-d5dff793af80b6534e9fb2e4f0301993bd209a4f.tar.bz2 |
Fix BZ #18084 -- backtrace (..., 0) dumps core on x86.
Other architectures also had bugs, or did unnecessary work.
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r-- | sysdeps/x86_64/backtrace.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/x86_64/backtrace.c b/sysdeps/x86_64/backtrace.c index 2a3848d..21448c8 100644 --- a/sysdeps/x86_64/backtrace.c +++ b/sysdeps/x86_64/backtrace.c @@ -97,6 +97,10 @@ __backtrace (array, size) int size; { struct trace_arg arg = { .array = array, .cfa = 0, .size = size, .cnt = -1 }; + + if (size <= 0) + return 0; + #ifdef SHARED __libc_once_define (static, once); @@ -105,8 +109,7 @@ __backtrace (array, size) return 0; #endif - if (size >= 1) - unwind_backtrace (backtrace_helper, &arg); + unwind_backtrace (backtrace_helper, &arg); /* _Unwind_Backtrace seems to put NULL address above _start. Fix it up here. */ |