[llvm] r232215 - Turn assertion into bitcode reading error
David Blaikie
dblaikie at gmail.com
Fri Mar 13 14:03:34 PDT 2015
Author: dblaikie
Date: Fri Mar 13 16:03:34 2015
New Revision: 232215
URL: http://llvm.org/viewvc/llvm-project?rev=232215&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=232215&r1=232214&r2=232215&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Mar 13 16:03:34 2015
@@ -3126,8 +3126,8 @@ std::error_code BitcodeReader::ParseFunc
}
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);
More information about the llvm-commits
mailing list