eina: fix random segfaults when displaying BT

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
This commit is contained in:
Jean Guyomarc'h 2017-12-19 16:33:18 +01:00
parent a1e05aa089
commit e835a02ebb
1 changed files with 1 additions and 1 deletions

View 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;