[BitcodeReader] Check vector size before trying to create a VectorType
Bug found with AFL fuzz llvm-svn: 238891
This commit is contained in:
@@ -1497,6 +1497,8 @@ std::error_code BitcodeReader::ParseTypeTableBody() {
|
||||
case bitc::TYPE_CODE_VECTOR: // VECTOR: [numelts, eltty]
|
||||
if (Record.size() < 2)
|
||||
return Error("Invalid record");
|
||||
if (Record[0] == 0)
|
||||
return Error("Invalid vector length");
|
||||
ResultTy = getTypeByID(Record[1]);
|
||||
if (!ResultTy || !StructType::isValidElementType(ResultTy))
|
||||
return Error("Invalid type");
|
||||
|
||||
Reference in New Issue
Block a user