[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:
Filipe Cabecinhas
2015-05-19 01:21:06 +00:00
parent 3b3cbed1b0
commit bf27e11e02
3 changed files with 9 additions and 1 deletions

View File

@ -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;
}