[Bitcode] Diagnose errors instead of asserting from bad input
authorFilipe Cabecinhas <me@filcab.net>
Sat, 24 Jan 2015 04:15:05 +0000 (04:15 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Sat, 24 Jan 2015 04:15:05 +0000 (04:15 +0000)
commit5d8bb5c7c5412fa6f54d5c9d6cf1878ed772a240
tree9ae82b70873452c3fe5b00da2ca45a37dd11c75e
parent6f409cbc050fc740fa06f60c9ad4602deb20e00c
[Bitcode] Diagnose errors instead of asserting from bad input

Eventually we can make some of these pass the error along to the caller.

Reports a fatal error if:
We find an invalid abbrev record
We try to get an invalid abbrev number
We can't fill the current word due to an EOF

Fixed an invalid bitcode test to check for output with FileCheck

Bugs found with afl-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226986 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Bitcode/BitstreamReader.h
lib/Bitcode/Reader/BitstreamReader.cpp
test/Bitcode/Inputs/invalid-abbrev.bc [new file with mode: 0644]
test/Bitcode/Inputs/invalid-bad-abbrev-number.bc [new file with mode: 0644]
test/Bitcode/Inputs/invalid-unexpected-eof.bc [new file with mode: 0644]
test/Bitcode/invalid.test