summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode/invalid.test
diff options
context:
space:
mode:
authorFilipe Cabecinhas <me@filcab.net>2015-01-24 04:15:05 +0000
committerFilipe Cabecinhas <me@filcab.net>2015-01-24 04:15:05 +0000
commitde968ecb05bd92f14105bbe3b7a19c6bfd69be39 (patch)
tree6767d94927e4ce8c3d33287c6e9ae2264f279eb3 /llvm/test/Bitcode/invalid.test
parentd1787adcec7f0ffa9ac002c1c04c7fc9c907f245 (diff)
downloadbcm5719-llvm-de968ecb05bd92f14105bbe3b7a19c6bfd69be39.tar.gz
bcm5719-llvm-de968ecb05bd92f14105bbe3b7a19c6bfd69be39.zip
[Bitcode] Diagnose errors instead of asserting from bad input
Eventually we can make some of these pass the error along to the caller. Reports a fatal error if: We find an invalid abbrev record We try to get an invalid abbrev number We can't fill the current word due to an EOF Fixed an invalid bitcode test to check for output with FileCheck Bugs found with afl-fuzz llvm-svn: 226986
Diffstat (limited to 'llvm/test/Bitcode/invalid.test')
-rw-r--r--llvm/test/Bitcode/invalid.test14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test
index 5f88da45f6a..19ef3267cc6 100644
--- a/llvm/test/Bitcode/invalid.test
+++ b/llvm/test/Bitcode/invalid.test
@@ -1 +1,13 @@
-RUN: not llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc 2>&1 | \
+RUN: FileCheck --check-prefix=INVALID-ENCODING %s
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev.bc 2>&1 | \
+RUN: FileCheck --check-prefix=BAD-ABBREV %s
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-unexpected-eof.bc 2>&1 | \
+RUN: FileCheck --check-prefix=UNEXPECTED-EOF %s
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-bad-abbrev-number.bc 2>&1 | \
+RUN: FileCheck --check-prefix=BAD-ABBREV-NUMBER %s
+
+INVALID-ENCODING: Invalid encoding
+BAD-ABBREV: Abbreviation starts with an Array or a Blob
+UNEXPECTED-EOF: Unexpected end of file
+BAD-ABBREV-NUMBER: Invalid abbrev number
OpenPOWER on IntegriCloud