aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle/MicrosoftDemangle.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-04-11 22:47:18 +0000
committerNico Weber <nicolasweber@gmx.de>2019-04-11 22:47:18 +0000
commitb4f33bbbb00a3e47e14081a9be352eb6a9b917b5 (patch)
tree4a2991c9c9e155f4ae1577daaf874d5eed4d2e0e /llvm/lib/Demangle/MicrosoftDemangle.cpp
parent8ec304c9fd92442393fcdd98f08fa07ac3ccf5df (diff)
downloadllvm-b4f33bbbb00a3e47e14081a9be352eb6a9b917b5.zip
llvm-b4f33bbbb00a3e47e14081a9be352eb6a9b917b5.tar.gz
llvm-b4f33bbbb00a3e47e14081a9be352eb6a9b917b5.tar.bz2
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. llvm-svn: 358237
Diffstat (limited to 'llvm/lib/Demangle/MicrosoftDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 194a152..f45df94 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -481,7 +481,7 @@ Demangler::demangleFunctionIdentifierCode(StringView &MangledName) {
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::demangleFunctionClass(StringView &MangledName) {
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);