[PATCH] D60204: llvm-undname: Fix an assert-on-invalid
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 16:18:14 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357647: llvm-undname: Fix an assert-on-invalid (authored by nico, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D60204?vs=193507&id=193624#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60204/new/
https://reviews.llvm.org/D60204
Files:
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/invalid-manglings.test
Index: llvm/trunk/test/Demangle/invalid-manglings.test
===================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test
+++ llvm/trunk/test/Demangle/invalid-manglings.test
@@ -14,3 +14,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ?@@8
; CHECK-NEXT: error: Invalid mangled name
+
+??
+; CHECK-EMPTY:
+; CHECK-NEXT: ??
+; CHECK-NEXT: error: Invalid mangled name
Index: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
@@ -466,6 +466,10 @@
Demangler::demangleFunctionIdentifierCode(StringView &MangledName) {
assert(MangledName.startsWith('?'));
MangledName = MangledName.dropFront();
+ if (MangledName.empty()) {
+ Error = true;
+ return nullptr;
+ }
if (MangledName.consumeFront("__"))
return demangleFunctionIdentifierCode(
@@ -637,6 +641,7 @@
IdentifierNode *
Demangler::demangleFunctionIdentifierCode(StringView &MangledName,
FunctionIdentifierCodeGroup Group) {
+ assert(!MangledName.empty());
switch (Group) {
case FunctionIdentifierCodeGroup::Basic:
switch (char CH = MangledName.popFront()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60204.193624.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/e206d516/attachment.bin>
More information about the llvm-commits
mailing list