[llvm] r232215 - Turn assertion into bitcode reading error
David Blaikie
dblaikie at gmail.com
Sat Mar 14 10:09:53 PDT 2015
Any examples of existing tests for invalid bitcode & how to construct such
input files?
On Mar 14, 2015 6:02 AM, "Rafael EspĂndola" <rafael.espindola at gmail.com>
wrote:
> Filipe has been adding tests for the error handling. The old testing
> situation was pretty bad, so if you could create a broken bitcode file to
> test this it would be awesome.
> On Mar 13, 2015 5:13 PM, "David Blaikie" <dblaikie at gmail.com> wrote:
>
>> 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);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150314/e0bfefd6/attachment.html>
More information about the llvm-commits
mailing list