summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-03-13 21:03:34 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-03-13 21:03:34 +0000
commit4a5c8c602c68e727a0d560d68d6bf9463b2d3cc2 (patch)
tree7dab429a73deed6b7c0e970e40cf6cc70fca6bce /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent84a2fe141ad65a0ba4cf8581edde820f4ca7388e (diff)
downloadbcm5719-llvm-4a5c8c602c68e727a0d560d68d6bf9463b2d3cc2.tar.gz
bcm5719-llvm-4a5c8c602c68e727a0d560d68d6bf9463b2d3cc2.zip
Turn assertion into bitcode reading error
I don't think we test invalid bitcode records in any detail, so no test here - just a change for consistency with existing error checks in surrounding code. llvm-svn: 232215
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index c4e070cd17b..33b02f912f0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3126,8 +3126,8 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
}
I = GetElementPtrInst::Create(BasePtr, GEPIdx);
- (void)Ty;
- assert(!Ty || Ty == cast<GetElementPtrInst>(I)->getSourceElementType());
+ if (Ty && Ty != cast<GetElementPtrInst>(I)->getSourceElementType())
+ return Error("Invalid record");
InstructionList.push_back(I);
if (InBounds)
cast<GetElementPtrInst>(I)->setIsInBounds(true);
OpenPOWER on IntegriCloud