[BitcodeReader] Make sure the type of the inserted value matches the type of the aggregate at those indices

Bug found with AFL-fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237628 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Filipe Cabecinhas
2015-05-18 22:27:11 +00:00
parent 4d632b44e2
commit b2bf278152
3 changed files with 8 additions and 0 deletions

View File

@ -3644,6 +3644,9 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
CurTy = CurTy->subtypes()[0];
}
if (CurTy != Val->getType())
return Error("Inserted value type doesn't match aggregate type");
I = InsertValueInst::Create(Agg, Val, INSERTVALIdx);
InstructionList.push_back(I);
break;