[llvm] r358237 - llvm-undname: Fix crash on incomplete virtual this adjusts
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 15:47:18 PDT 2019
Author: nico
Date: Thu Apr 11 15:47:18 2019
New Revision: 358237
URL: http://llvm.org/viewvc/llvm-project?rev=358237&view=rev
Log:
llvm-undname: Fix crash on incomplete virtual this adjusts
Found by oss-fuzz.
Also remove an else-after-return, this part has no behavior change.
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=358237&r1=358236&r2=358237&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Thu Apr 11 15:47:18 2019
@@ -481,7 +481,7 @@ Demangler::demangleFunctionIdentifierCod
if (MangledName.consumeFront("__"))
return demangleFunctionIdentifierCode(
MangledName, FunctionIdentifierCodeGroup::DoubleUnder);
- else if (MangledName.consumeFront("_"))
+ if (MangledName.consumeFront("_"))
return demangleFunctionIdentifierCode(MangledName,
FunctionIdentifierCodeGroup::Under);
return demangleFunctionIdentifierCode(MangledName,
@@ -1575,7 +1575,8 @@ FuncClass Demangler::demangleFunctionCla
FuncClass VFlag = FC_VirtualThisAdjust;
if (MangledName.consumeFront('R'))
VFlag = FuncClass(VFlag | FC_VirtualThisAdjustEx);
-
+ if (MangledName.empty())
+ break;
switch (MangledName.popFront()) {
case '0':
return FuncClass(FC_Private | FC_Virtual | VFlag);
Modified: llvm/trunk/test/Demangle/invalid-manglings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/invalid-manglings.test?rev=358237&r1=358236&r2=358237&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Thu Apr 11 15:47:18 2019
@@ -99,3 +99,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ?B@?$?K$H?
; CHECK-NEXT: error: Invalid mangled name
+
+??C@$
+; CHECK-EMPTY:
+; CHECK-NEXT: ??C@$
+; CHECK-NEXT: error: Invalid mangled name
More information about the llvm-commits
mailing list