From 75cc2505da498a396038d27665ba711db9360679 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 13 Mar 2015 21:03:34 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232215 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index c4e070cd17b..33b02f912f0 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/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(I)->getSourceElementType()); + if (Ty && Ty != cast(I)->getSourceElementType()) + return Error("Invalid record"); InstructionList.push_back(I); if (InBounds) cast(I)->setIsInBounds(true); -- 2.34.1