mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
[BitcodeReader] Error out if we read an invalid function argument type
Bug found with AFL fuzz. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237650 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b3cbed1b0
commit
bf27e11e02
@ -1402,8 +1402,11 @@ std::error_code BitcodeReader::ParseTypeTableBody() {
|
||||
return Error("Invalid record");
|
||||
SmallVector<Type*, 8> ArgTys;
|
||||
for (unsigned i = 2, e = Record.size(); i != e; ++i) {
|
||||
if (Type *T = getTypeByID(Record[i]))
|
||||
if (Type *T = getTypeByID(Record[i])) {
|
||||
if (!FunctionType::isValidArgumentType(T))
|
||||
return Error("Invalid function argument type");
|
||||
ArgTys.push_back(T);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
BIN
test/Bitcode/Inputs/invalid-function-argument-type.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-function-argument-type.bc
Normal file
Binary file not shown.
@ -152,3 +152,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-code-len-width.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=INVALID-CODELENWIDTH %s
|
||||
|
||||
INVALID-CODELENWIDTH: Malformed block
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
|
||||
|
||||
INVALID-ARGUMENT-TYPE: Invalid function argument type
|
||||
|
Loading…
Reference in New Issue
Block a user