llvm-undname: Fix an assert-on-invalid, found by oss-fuzz

llvm-svn: 358891
This commit is contained in:
Nico Weber 2019-04-22 15:05:18 +00:00
parent 70346d127b
commit f5c7f3ad33
2 changed files with 6 additions and 1 deletions

View File

@ -1040,7 +1040,7 @@ wchar_t Demangler::demangleWcharLiteral(StringView &MangledName) {
uint8_t C1, C2;
C1 = demangleCharLiteral(MangledName);
if (Error)
if (Error || MangledName.empty())
goto WCharLiteralError;
C2 = demangleCharLiteral(MangledName);
if (Error)

View File

@ -164,3 +164,8 @@
; CHECK-EMPTY:
; CHECK-NEXT: ??_C@_0601234567@abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyz
; CHECK-NEXT: error: Invalid mangled name
??_C@_12@?z
; CHECK-EMPTY:
; CHECK-NEXT: ??_C@_12@?z
; CHECK-NEXT: error: Invalid mangled name