summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-05-29 19:58:59 +0000
committerSam Clegg <sbc@chromium.org>2018-05-29 19:58:59 +0000
commitb7c6239408d6c04c9e4743dc30678168a1b60cb5 (patch)
tree381cb599dc5fe27ece21fd142ba7ac58ecce5b30 /llvm/test/Object
parent4b3829d8cfa6926cf9af8b044c25d43027fe50d1 (diff)
downloadbcm5719-llvm-b7c6239408d6c04c9e4743dc30678168a1b60cb5.tar.gz
bcm5719-llvm-b7c6239408d6c04c9e4743dc30678168a1b60cb5.zip
[WebAssembly] Add more error checking to object file parsing
This should address some of the assert failures the fuzzer has been finding such as: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6719 Differential Revision: https://reviews.llvm.org/D47086 llvm-svn: 333459
Diffstat (limited to 'llvm/test/Object')
-rw-r--r--llvm/test/Object/wasm-invalid-file.yaml16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Object/wasm-invalid-file.yaml b/llvm/test/Object/wasm-invalid-file.yaml
new file mode 100644
index 00000000000..3c16291c06d
--- /dev/null
+++ b/llvm/test/Object/wasm-invalid-file.yaml
@@ -0,0 +1,16 @@
+# RUN: yaml2obj %s > %t.wasm
+# RUN: echo -en "\x01" >> %t.wasm
+# Append a new section but truncate the encoding of the section size
+# RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-LEB-DECODE
+
+!WASM
+FileHeader:
+ Version: 0x00000001
+
+# CHECK-LEB-DECODE: malformed uleb128, extends past end
+
+# RUN: echo -en "\x99hello" >> %t.wasm
+# Append a section size that extends beyond the end of the file
+# RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-SECTION-SIZE
+
+# CHECK-SECTION-SIZE: '{{.*}}.wasm': Section too large
OpenPOWER on IntegriCloud