summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Demangle/MicrosoftDemangle.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-04-03 23:23:32 +0000
committerNico Weber <nicolasweber@gmx.de>2019-04-03 23:23:32 +0000
commita9886f8278921a78ba6f9e15395b39e74586aba1 (patch)
tree9fc351215c4b1e0eac000ef108194ee01efc5e1f /llvm/lib/Demangle/MicrosoftDemangle.cpp
parent321de48a94096f83a4be5164bce462e6285413c7 (diff)
downloadbcm5719-llvm-a9886f8278921a78ba6f9e15395b39e74586aba1.tar.gz
bcm5719-llvm-a9886f8278921a78ba6f9e15395b39e74586aba1.zip
llvm-undame: Fix an assert-on-invalid
Found by oss-fuzz, fixes issue 12432 on os-fuzz. Differential Revision: https://reviews.llvm.org/D60206 llvm-svn: 357648
Diffstat (limited to 'llvm/lib/Demangle/MicrosoftDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index b4e5cef7ac5..653c76e052f 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -1389,9 +1389,12 @@ Demangler::demangleFullyQualifiedSymbolName(StringView &MangledName) {
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);
}
OpenPOWER on IntegriCloud