[llvm] r361402 - llvm-undname: Fix an assert-on-invalid, found by oss-fuzz
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 08:53:23 PDT 2019
Author: nico
Date: Wed May 22 08:53:23 2019
New Revision: 361402
URL: http://llvm.org/viewvc/llvm-project?rev=361402&view=rev
Log:
llvm-undname: Fix an assert-on-invalid, found by oss-fuzz
If a template parameter refers to a pointer to member, but the mangling
of that was a string literal instead of a real symbol, llvm-undname used
to crash instead of rejecting the input.
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=361402&r1=361401&r2=361402&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Wed May 22 08:53:23 2019
@@ -2175,8 +2175,10 @@ Demangler::demangleTemplateParameterList
SymbolNode *S = nullptr;
if (MangledName.startsWith('?')) {
S = parse(MangledName);
- if (Error)
+ if (Error || !S->Name) {
+ Error = true;
return nullptr;
+ }
memorizeIdentifier(S->Name->getUnqualifiedIdentifier());
}
Modified: llvm/trunk/test/Demangle/invalid-manglings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/invalid-manglings.test?rev=361402&r1=361401&r2=361402&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Wed May 22 08:53:23 2019
@@ -169,3 +169,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ??_C at _12@?z
; CHECK-NEXT: error: Invalid mangled name
+
+??$foo@$1??_C at _02PCEFGMJL@hi?$AA@@
+; CHECK-EMPTY:
+; CHECK-NEXT: ??$foo@$1??_C at _02PCEFGMJL@hi?$AA@@
+; CHECK-NEXT: error: Invalid mangled name
More information about the llvm-commits
mailing list