forked from OSchip/llvm-project
llvm-undname: Fix an assert-on-invalid, found by oss-fuzz
If a template parameter refers to a pointer to member, but the mangling of that was a string literal instead of a real symbol, llvm-undname used to crash instead of rejecting the input. llvm-svn: 361402
This commit is contained in:
parent
5a4f7cf2ff
commit
09fb2029e5
|
@ -2175,8 +2175,10 @@ Demangler::demangleTemplateParameterList(StringView &MangledName) {
|
|||
SymbolNode *S = nullptr;
|
||||
if (MangledName.startsWith('?')) {
|
||||
S = parse(MangledName);
|
||||
if (Error)
|
||||
if (Error || !S->Name) {
|
||||
Error = true;
|
||||
return nullptr;
|
||||
}
|
||||
memorizeIdentifier(S->Name->getUnqualifiedIdentifier());
|
||||
}
|
||||
|
||||
|
|
|
@ -169,3 +169,8 @@
|
|||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??_C@_12@?z
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
||||
??$foo@$1??_C@_02PCEFGMJL@hi?$AA@@
|
||||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??$foo@$1??_C@_02PCEFGMJL@hi?$AA@@
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
|
Loading…
Reference in New Issue