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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Filipe Cabecinhas
2015-10-29 23:37:28 +00:00
parent 57ece5c685
commit b0ed17be63
3 changed files with 8 additions and 1 deletions

View File

@@ -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);