From 4708a02a78d9701d175aa134fc2b0da60e3efbd0 Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Mon, 18 May 2015 22:27:11 +0000 Subject: [BitcodeReader] Make sure the type of the inserted value matches the type of the aggregate at those indices Bug found with AFL-fuzz. llvm-svn: 237628 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 86c61bd..70b6810 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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; -- cgit v1.1