[PATCH] D60206: llvm-undame: Fix an assert-on-invalid
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 08:32:38 PDT 2019
thakis created this revision.
thakis added a reviewer: zturner.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Found by oss-fuzz, fixes issue 12432 on os-fuzz.
https://reviews.llvm.org/D60206
Files:
llvm/lib/Demangle/MicrosoftDemangle.cpp
llvm/test/Demangle/invalid-manglings.test
Index: llvm/test/Demangle/invalid-manglings.test
===================================================================
--- llvm/test/Demangle/invalid-manglings.test
+++ llvm/test/Demangle/invalid-manglings.test
@@ -19,3 +19,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ??
; CHECK-NEXT: error: Invalid mangled name
+
+??0@
+; CHECK-EMPTY:
+; CHECK-NEXT: ??0@
+; CHECK-NEXT: error: Invalid mangled name
Index: llvm/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -1389,9 +1389,12 @@
return nullptr;
if (Identifier->kind() == NodeKind::StructorIdentifier) {
+ if (QN->Components->Count < 2) {
+ Error = true;
+ return nullptr;
+ }
StructorIdentifierNode *SIN =
static_cast<StructorIdentifierNode *>(Identifier);
- assert(QN->Components->Count >= 2);
Node *ClassNode = QN->Components->Nodes[QN->Components->Count - 2];
SIN->Class = static_cast<IdentifierNode *>(ClassNode);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60206.193513.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/246cf187/attachment.bin>
More information about the llvm-commits
mailing list