[compiler-rt] r254068 - [sanitizer] Fix a crash with DlAddrSymbolizer and unnamed symbols
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 25 05:11:39 PST 2015
Author: kuba.brecka
Date: Wed Nov 25 07:11:38 2015
New Revision: 254068
URL: http://llvm.org/viewvc/llvm-project?rev=254068&view=rev
Log:
[sanitizer] Fix a crash with DlAddrSymbolizer and unnamed symbols
Apparently, dladdr() can succeed but return a NULL pointer, in which case strdup will crash. Let's not call strdup on NULL pointers.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc?rev=254068&r1=254067&r2=254068&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc Wed Nov 25 07:11:38 2015
@@ -33,7 +33,7 @@ bool DlAddrSymbolizer::SymbolizePC(uptr
int result = dladdr((const void *)addr, &info);
if (!result) return false;
const char *demangled = DemangleCXXABI(info.dli_sname);
- stack->info.function = internal_strdup(demangled);
+ stack->info.function = demangled ? internal_strdup(demangled) : nullptr;
return true;
}
More information about the llvm-commits
mailing list