aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-05-18 22:27:11 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-05-18 22:27:11 +0000
commit4708a02a78d9701d175aa134fc2b0da60e3efbd0 (patch)
treed91b9cd27ec56452d434bd184e11cfeb789d4c38 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent09808a991c121bdce1a7ee1cf16b4c59a7c02192 (diff)
downloadllvm-4708a02a78d9701d175aa134fc2b0da60e3efbd0.zip
llvm-4708a02a78d9701d175aa134fc2b0da60e3efbd0.tar.gz
llvm-4708a02a78d9701d175aa134fc2b0da60e3efbd0.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp3
1 files changed, 3 insertions, 0 deletions
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;