diff options
author | Julien Cristau <jcristau@debian.org> | 2011-12-30 20:41:25 +0100 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2012-01-18 11:37:08 -0800 |
commit | d395749a4eb8c34189600ca34cb66f65803e462e (patch) | |
tree | e20bb15805c2b820e6045e68a814a336db5df82d | |
parent | 977ea84992657abe17b372578c5952c0b6d54c1f (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>
(cherry picked from commit 6269977c91071e0ea16ca5b4b8e15fd6db0b6fcf)
(cherry picked from commit 4a339afc586d55a9a248b893f007219d79c72600)
-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 7ca6dab6d..f3255c738 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -44,7 +44,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, |