Merge pull request #579 from arj-fb/safety_check_at_SymbolizeAndDemangle

Added check for if info.dli_sname is NULL
This commit is contained in:
Sergiu Deitsch 2020-09-29 22:10:08 +02:00 committed by GitHub
commit d442460690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -857,11 +857,13 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
int out_size) {
Dl_info info;
if (dladdr(pc, &info)) {
if ((int)strlen(info.dli_sname) < out_size) {
strcpy(out, info.dli_sname);
// Symbolization succeeded. Now we try to demangle the symbol.
DemangleInplace(out, out_size);
return true;
if (info.dli_sname) {
if ((int)strlen(info.dli_sname) < out_size) {
strcpy(out, info.dli_sname);
// Symbolization succeeded. Now we try to demangle the symbol.
DemangleInplace(out, out_size);
return true;
}
}
}
return false;