forked from OSchip/llvm-project
llvm-undname: Fix out-of-bounds read on invalid intrinsic function code
Found by inspection. llvm-svn: 358239
This commit is contained in:
parent
e5b62654a5
commit
03db625c13
|
@ -207,6 +207,8 @@ private:
|
|||
NamedIdentifierNode *demangleBackRefName(StringView &MangledName);
|
||||
IdentifierNode *demangleTemplateInstantiationName(StringView &MangledName,
|
||||
NameBackrefBehavior NBB);
|
||||
IntrinsicFunctionKind
|
||||
translateIntrinsicFunctionCode(char CH, FunctionIdentifierCodeGroup Group);
|
||||
IdentifierNode *demangleFunctionIdentifierCode(StringView &MangledName);
|
||||
IdentifierNode *
|
||||
demangleFunctionIdentifierCode(StringView &MangledName,
|
||||
|
|
|
@ -511,12 +511,18 @@ Demangler::demangleLiteralOperatorIdentifier(StringView &MangledName) {
|
|||
return N;
|
||||
}
|
||||
|
||||
static IntrinsicFunctionKind
|
||||
translateIntrinsicFunctionCode(char CH, FunctionIdentifierCodeGroup Group) {
|
||||
IntrinsicFunctionKind
|
||||
Demangler::translateIntrinsicFunctionCode(char CH,
|
||||
FunctionIdentifierCodeGroup Group) {
|
||||
using IFK = IntrinsicFunctionKind;
|
||||
if (!(CH >= '0' && CH <= '9') && !(CH >= 'A' && CH <= 'Z')) {
|
||||
Error = true;
|
||||
return IFK::None;
|
||||
}
|
||||
|
||||
// Not all ? identifiers are intrinsics *functions*. This function only maps
|
||||
// operator codes for the special functions, all others are handled elsewhere,
|
||||
// hence the IFK::None entries in the table.
|
||||
using IFK = IntrinsicFunctionKind;
|
||||
static IFK Basic[36] = {
|
||||
IFK::None, // ?0 # Foo::Foo()
|
||||
IFK::None, // ?1 # Foo::~Foo()
|
||||
|
|
|
@ -109,3 +109,8 @@
|
|||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ?x@@3PAW
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
||||
??}
|
||||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??}
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
|
Loading…
Reference in New Issue