llvm-undname: Fix another crash-on-invalid found by oss-fuzz
llvm-svn: 358363
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 719e716..882913a 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -654,7 +654,10 @@
IdentifierNode *
Demangler::demangleFunctionIdentifierCode(StringView &MangledName,
FunctionIdentifierCodeGroup Group) {
- assert(!MangledName.empty());
+ if (MangledName.empty()) {
+ Error = true;
+ return nullptr;
+ }
switch (Group) {
case FunctionIdentifierCodeGroup::Basic:
switch (char CH = MangledName.popFront()) {