eina: fix random segfaults when displaying BT
authorJean Guyomarc'h <jean@guyomarch.bzh>
Tue, 19 Dec 2017 15:33:18 +0000 (16:33 +0100)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 10 Jan 2018 11:08:13 +0000 (20:08 +0900)
Under some circumstances, eina crashes when attempting to display the
backtrace, because dladdr() may yield a dli_fname that is NULL. This is
especially annoying in realease, when the backtrace is shown by default
when CRI/ERR are thrown.

@fix

src/lib/eina/eina_debug_bt.c

index c9bf23c..21b067c 100644 (file)
@@ -67,7 +67,7 @@ _eina_debug_dump_fhandle_bt(FILE *f, void **bt, int btlen)
         offset = base = 0;
         // we have little choice but to hope/assume dladdr() doesn't alloc
         // anything here
-        if ((dladdr(bt[i], &info)) && (info.dli_fname[0]))
+        if ((dladdr(bt[i], &info)) && (info.dli_fname) && (info.dli_fname[0]))
           {
              offset = (unsigned long long)(uintptr_t)bt[i];
              base = (unsigned long long)(uintptr_t)info.dli_fbase;