[llvm] r358234 - llvm-undname: Fix crash on invalid name in a template parameter pointer to member arg

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 15:23:35 PDT 2019


Author: nico
Date: Thu Apr 11 15:23:35 2019
New Revision: 358234

URL: http://llvm.org/viewvc/llvm-project?rev=358234&view=rev
Log:
llvm-undname: Fix crash on invalid name in a template parameter pointer to member arg

Found by oss-fuzz.

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=358234&r1=358233&r2=358234&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Thu Apr 11 15:23:35 2019
@@ -2139,6 +2139,8 @@ Demangler::demangleTemplateParameterList
       SymbolNode *S = nullptr;
       if (MangledName.startsWith('?')) {
         S = parse(MangledName);
+        if (Error)
+          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=358234&r1=358233&r2=358234&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Thu Apr 11 15:23:35 2019
@@ -94,3 +94,8 @@
 ; CHECK-EMPTY:
 ; CHECK-NEXT: ??8 at 8
 ; CHECK-NEXT: error: Invalid mangled name
+
+?B@?$?K$H?
+; CHECK-EMPTY:
+; CHECK-NEXT: ?B@?$?K$H?
+; CHECK-NEXT: error: Invalid mangled name




More information about the llvm-commits mailing list