[BitcodeReader] Error out if we read an invalid function argument type

Bug found with AFL fuzz.

llvm-svn: 237650
This commit is contained in:
Filipe Cabecinhas
2015-05-19 01:21:06 +00:00
parent cbb2334b7a
commit 32af542194
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;
}