diff options
author | Filipe Cabecinhas <me@filcab.net> | 2015-10-29 23:37:28 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2015-10-29 23:37:28 +0000 |
commit | bcfd1f0c5607c4a0a231e55961baf4a5a36c8c3c (patch) | |
tree | 40da317577eea800db9dbc9f158f3b7fb365a54d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | f5ea072e019bd87689f9d00877d267c91ff2c8a1 (diff) | |
download | bcm5719-llvm-bcfd1f0c5607c4a0a231e55961baf4a5a36c8c3c.tar.gz bcm5719-llvm-bcfd1f0c5607c4a0a231e55961baf4a5a36c8c3c.zip |
Don't assert if materializing before seeing any function bodies
This assert was reachable from user input. A minimized test case (no
FUNCTION_BLOCK_ID record) is attached.
Bug found with afl-fuzz
llvm-svn: 251667
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index e23f8176330..d2cbe9e85a4 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3054,7 +3054,9 @@ std::error_code BitcodeReader::rememberAndSkipFunctionBodies() { if (Stream.AtEndOfStream()) return error("Could not find function in stream"); - assert(SeenFirstFunctionBody); + if (!SeenFirstFunctionBody) + return error("Trying to materialize functions before seeing function blocks"); + // An old bitcode file with the symbol table at the end would have // finished the parse greedily. assert(SeenValueSymbolTable); |