[llvm] r358363 - llvm-undname: Fix another crash-on-invalid found by oss-fuzz
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 16:08:12 PDT 2019
Author: nico
Date: Sun Apr 14 16:08:12 2019
New Revision: 358363
URL: http://llvm.org/viewvc/llvm-project?rev=358363&view=rev
Log:
llvm-undname: Fix another crash-on-invalid 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=358363&r1=358362&r2=358363&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Sun Apr 14 16:08:12 2019
@@ -654,7 +654,10 @@ Demangler::translateIntrinsicFunctionCod
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()) {
Modified: llvm/trunk/test/Demangle/invalid-manglings.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/invalid-manglings.test?rev=358363&r1=358362&r2=358363&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test (original)
+++ llvm/trunk/test/Demangle/invalid-manglings.test Sun Apr 14 16:08:12 2019
@@ -114,3 +114,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ??}
; CHECK-NEXT: error: Invalid mangled name
+
+?foo@?$?_
+; CHECK-EMPTY:
+; CHECK-NEXT: ?foo@?$?_
+; CHECK-NEXT: error: Invalid mangled name
More information about the llvm-commits
mailing list