forked from OSchip/llvm-project
llvm-undname: Fix stack overflow on invalid found by oss-fuzz
llvm-svn: 358852
This commit is contained in:
parent
f985e31254
commit
aa162682ca
|
@ -1292,7 +1292,7 @@ Demangler::demangleStringLiteral(StringView &MangledName) {
|
|||
|
||||
unsigned BytesDecoded = 0;
|
||||
while (!MangledName.consumeFront('@')) {
|
||||
if (MangledName.size() < 1)
|
||||
if (MangledName.size() < 1 || BytesDecoded >= MaxStringByteLength)
|
||||
goto StringLiteralError;
|
||||
StringBytes[BytesDecoded++] = demangleCharLiteral(MangledName);
|
||||
}
|
||||
|
|
|
@ -159,3 +159,8 @@
|
|||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??_C@_1301234567@a
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
||||
??_C@_0601234567@abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyz
|
||||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??_C@_0601234567@abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrtsuvwxyz
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
|
Loading…
Reference in New Issue