diff options
| author | Florian Hahn <flo@fhahn.com> | 2019-08-21 18:20:11 +0000 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2019-08-21 18:20:11 +0000 |
| commit | 969b3e6a8fa3b324bbae72b089e2047f4741408b (patch) | |
| tree | 972217254878f7290f62b21621241900093f299d /llvm/test/Bitcode | |
| parent | e4876c9d71ee4f416578579169792a53b73e7cf8 (diff) | |
| download | bcm5719-llvm-969b3e6a8fa3b324bbae72b089e2047f4741408b.tar.gz bcm5719-llvm-969b3e6a8fa3b324bbae72b089e2047f4741408b.zip | |
[BitcodeReader] Check if we can create a null constant for type.
We cannot create null constants for certain types, e.g. VoidTy,
FunctionTy or LabelTy. getNullValue asserts if we pass in an
unsupported type. We should also check for opaque types, but I'm not
sure how.
This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14795.
Reviewers: t.p.northover, jfb, vsk
Reviewed By: vsk
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65897
llvm-svn: 369557
Diffstat (limited to 'llvm/test/Bitcode')
| -rw-r--r-- | llvm/test/Bitcode/invalid-type-for-null-constant.ll | 6 | ||||
| -rw-r--r-- | llvm/test/Bitcode/invalid-type-for-null-constant.ll.bc | bin | 0 -> 900 bytes |
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/invalid-type-for-null-constant.ll b/llvm/test/Bitcode/invalid-type-for-null-constant.ll new file mode 100644 index 00000000000..28756fa1823 --- /dev/null +++ b/llvm/test/Bitcode/invalid-type-for-null-constant.ll @@ -0,0 +1,6 @@ +; Bitcode with a CST_CODE_NULL with void type. + +; RUN: not llvm-dis %s.bc -o - 2>&1 | FileCheck %s + +; CHECK: error: Invalid type for a constant null value + diff --git a/llvm/test/Bitcode/invalid-type-for-null-constant.ll.bc b/llvm/test/Bitcode/invalid-type-for-null-constant.ll.bc Binary files differnew file mode 100644 index 00000000000..6196ebccb9d --- /dev/null +++ b/llvm/test/Bitcode/invalid-type-for-null-constant.ll.bc |

