[llvm] r358112 - llvm-undname: Fix another crash-on-invalid
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 10:31:34 PDT 2019
Author: nico
Date: Wed Apr 10 10:31:34 2019
New Revision: 358112
URL: http://llvm.org/viewvc/llvm-project?rev=358112&view=rev
Log:
llvm-undname: Fix another crash-on-invalid
This fixes a regression from https://reviews.llvm.org/D60354. We used to
SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
if (Symbol) {
Symbol->Name = QN;
}
but changed that to
SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
if (Error)
return nullptr;
Symbol->Name = QN;
and one branch somewhere returned a nullptr without setting Error.
Looking at the code changed in r340083 and r340710 that branch looks
like a remnant from an earlier attempt to demangle RTTI descriptors
that has since been rewritten -- so just remove this branch. It
shouldn't change behavior for correctly mangled symbols.
Modified:
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/invalid-manglings.test
Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=358112&r1=358111&r2=358112&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Wed Apr 10 10:31:34 2019
@@ -696,8 +696,6 @@ SymbolNode *Demangler::demangleEncodedSy
StorageClass SC = demangleVariableStorageClass(MangledName);
return demangleVariableEncoding(MangledName, SC);
}
- case '8':
- return nullptr;
}
FunctionSymbolNode *FSN = demangleFunctionEncoding(MangledName);
Modified: llvm/trunk/test/Demangle/invalid-manglings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/invalid-manglings.test?rev=358112&r1=358111&r2=358112&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Wed Apr 10 10:31:34 2019
@@ -89,3 +89,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ??__E?Foo@@0HA@@
; CHECK-NEXT: error: Invalid mangled name
+
+??8 at 8
+; CHECK-EMPTY:
+; CHECK-NEXT: ??8 at 8
+; CHECK-NEXT: error: Invalid mangled name
More information about the llvm-commits
mailing list