summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-11-03 13:48:26 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-11-03 13:48:26 +0000
commit7aae2f23c85feab28bc2f47c11067bd6f11af7f6 (patch)
treeb584bbe970d6c21414e245edbd0bb23d7c5efb36 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentf3e167af4b714487982208cb4b94218cdfbb75c1 (diff)
downloadbcm5719-llvm-7aae2f23c85feab28bc2f47c11067bd6f11af7f6.tar.gz
bcm5719-llvm-7aae2f23c85feab28bc2f47c11067bd6f11af7f6.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: 251910
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 74a5553ce6e..c874a84e0cb 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3055,7 +3055,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);
OpenPOWER on IntegriCloud