Error out of ParseBitcodeInto(Module*) if we haven't read a Module
authorFilipe Cabecinhas <me@filcab.net>
Tue, 14 Apr 2015 14:07:15 +0000 (14:07 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Tue, 14 Apr 2015 14:07:15 +0000 (14:07 +0000)
commit9a1030a4d6febc9133de25dce7cda1bae513e8cf
treec6fd1ea9645a24ce4476392b7e57b3054473952a
parent685f2d6895f58246bfce4dc1b654c7f75a97aae9
Error out of ParseBitcodeInto(Module*) if we haven't read a Module

Summary:
Without this check the following case failed:

Skip a SubBlock which is not a MODULE_BLOCK_ID nor a BLOCKINFO_BLOCK_ID
Got to end of file

TheModule would still be == nullptr, and we would subsequentially fail
when materializing the Module (assert at the start of
BitcodeReader::MaterializeModule).

Bug found with AFL.

Reviewers: dexonsmith, rafael

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9014

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234887 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Bitcode/Reader/BitcodeReader.cpp
test/Bitcode/Inputs/invalid-no-proper-module.bc [new file with mode: 0644]
test/Bitcode/invalid.test