diff options
author | Filipe Cabecinhas <me@filcab.net> | 2015-04-14 14:07:15 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2015-04-14 14:07:15 +0000 |
commit | 225542713b0d5e1c42055e0e77bc56c140100d75 (patch) | |
tree | ee616f640fa5531be7d0c7246cb77681fb44ef11 /llvm/test/Bitcode | |
parent | daa4d45c0aa771b999df714a07234979e7746f83 (diff) | |
download | bcm5719-llvm-225542713b0d5e1c42055e0e77bc56c140100d75.tar.gz bcm5719-llvm-225542713b0d5e1c42055e0e77bc56c140100d75.zip |
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
llvm-svn: 234887
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r-- | llvm/test/Bitcode/Inputs/invalid-no-proper-module.bc | bin | 0 -> 612 bytes | |||
-rw-r--r-- | llvm/test/Bitcode/invalid.test | 5 |
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/Inputs/invalid-no-proper-module.bc b/llvm/test/Bitcode/Inputs/invalid-no-proper-module.bc Binary files differnew file mode 100644 index 00000000000..6d5a291db63 --- /dev/null +++ b/llvm/test/Bitcode/Inputs/invalid-no-proper-module.bc diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test index 0eacb9dbbb1..9cab227ab19 100644 --- a/llvm/test/Bitcode/invalid.test +++ b/llvm/test/Bitcode/invalid.test @@ -50,3 +50,8 @@ EXTRACT-IDXS: EXTRACTVAL: Invalid type INSERT-ARRAY: INSERTVAL: Invalid array index INSERT-STRUCT: INSERTVAL: Invalid struct index INSERT-IDXS: INSERTVAL: Invalid type + +RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-proper-module.bc 2>&1 | \ +RUN: FileCheck --check-prefix=NO-MODULE %s + +NO-MODULE: Malformed IR file |