[compiler-rt] [sanitizer] Fail __sanitizer_symbolize_demangle instead of returning input (PR #66006)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 13:46:54 PDT 2023
llvmbot wrote:
@llvm/pr-subscribers-compiler-rt-sanitizer
<details>
<summary>Changes</summary>
LLVMSymbolizer::DemangleName returns the same input if it can't demangle.
We can't tell if this is already demangled or format is unsupported.
Internally DemangleName uses nonMicrosoftDemangle which can report a failure.
--
Full diff: https://github.com/llvm/llvm-project/pull/66006.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp (+4-2)
<pre>
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp b/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
index 6ca4b9835bf3acd..f6dac78337068b5 100644
--- a/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp
@@ -17,6 +17,7 @@
#include "llvm/DebugInfo/Symbolize/DIPrinter.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
+#include "llvm/Demangle/Demangle.h"
static llvm::symbolize::LLVMSymbolizer *Symbolizer = nullptr;
static bool Demangle = true;
@@ -117,8 +118,9 @@ void __sanitizer_symbolize_flush() {
bool __sanitizer_symbolize_demangle(const char *Name, char *Buffer,
int MaxLength) {
- std::string Result =
- llvm::symbolize::LLVMSymbolizer::DemangleName(Name, nullptr);
+ std::string Result;
+ if (!llvm::nonMicrosoftDemangle(Name, Result))
+ return false;
return __sanitizer::internal_snprintf(Buffer, MaxLength, "%s",
Result.c_str()) < MaxLength;
}
</pre>
</details>
https://github.com/llvm/llvm-project/pull/66006
More information about the llvm-commits
mailing list