diff options
author | Julien Cristau <jcristau@debian.org> | 2011-12-30 20:41:25 +0100 |
---|---|---|
committer | Cyril Brulebois <kibi@debian.org> | 2011-12-31 02:34:55 +0100 |
commit | 6269977c91071e0ea16ca5b4b8e15fd6db0b6fcf (patch) | |
tree | d0fb5231a3e84a64d8b481f2cce2e8a42568086d | |
parent | 644efb43e0639af648dd46d9729c2cabd9511238 (diff) |
os: don't ignore failure from dladdr
If dladdr returns 0, don't go and use the returned Dl_info, it may
contain garbage.
X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315>
Reported-and-tested-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r-- | os/backtrace.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/os/backtrace.c b/os/backtrace.c index 58b4b1f34..298bf1898 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -46,7 +46,11 @@ void xorg_backtrace(void) ErrorF("\nBacktrace:\n"); size = backtrace(array, 64); for (i = 0; i < size; i++) { - dladdr(array[i], &info); + int rc = dladdr(array[i], &info); + if (rc == 0) { + ErrorF("%d: ?? [%p]\n", i, array[i]); + continue; + } mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)"; if (info.dli_saddr) ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod, |