summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Demangle
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-04-16 14:10:34 +0000
committerNico Weber <nicolasweber@gmx.de>2019-04-16 14:10:34 +0000
commitc035c243da36e2fa867626ef8af467fdda73ac80 (patch)
treed4cab705263fac33b2896f6f9003d885083cdf74 /llvm/lib/Demangle
parenta0a2264ef757f8383c6b283b7ad80b33d5d52f13 (diff)
downloadbcm5719-llvm-c035c243da36e2fa867626ef8af467fdda73ac80.tar.gz
bcm5719-llvm-c035c243da36e2fa867626ef8af467fdda73ac80.zip
llvm-undname: Fix nullptr deref on invalid structor names in template args
Similar to r358421: A StructorIndentifierNode has a Class field which is read when printing it, but if the StructorIndentifierNode appears in a template argument then demangleFullyQualifiedSymbolName() which sets Class isn't called. Since StructorIndentifierNodes are always leaf names, we can just reject them as well. Found by oss-fuzz. llvm-svn: 358491
Diffstat (limited to 'llvm/lib/Demangle')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index c3bdfa23d1f..49cfcde9c58 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -949,9 +949,10 @@ Demangler::demangleTemplateInstantiationName(StringView &MangledName,
if (NBB & NBB_Template) {
// NBB_Template is only set for types and non-leaf names ("a::" in "a::b").
- // A conversion operator only makes sense in a leaf name , so reject it in
- // NBB_Template contexts.
- if (Identifier->kind() == NodeKind::ConversionOperatorIdentifier) {
+ // Structors and conversion operators only makes sense in a leaf name, so
+ // reject them in NBB_Template contexts.
+ if (Identifier->kind() == NodeKind::ConversionOperatorIdentifier ||
+ Identifier->kind() == NodeKind::StructorIdentifier) {
Error = true;
return nullptr;
}
OpenPOWER on IntegriCloud