summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-10-23 18:04:34 +0000
committerVedant Kumar <vsk@apple.com>2017-10-23 18:04:34 +0000
commit35b50a83aba3a5eedd3395341b5be76600a6841c (patch)
treef70f4bba61b5f853cf7edcf6653510af4d8505b7 /llvm/test/tools
parent1108d072f47b74ff671df61b434a18da02f4dd3e (diff)
downloadbcm5719-llvm-35b50a83aba3a5eedd3395341b5be76600a6841c.tar.gz
bcm5719-llvm-35b50a83aba3a5eedd3395341b5be76600a6841c.zip
[wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)
A wasm file crafted with a bogus section size can trigger an ASan issue in the DWARFObjInMemory constructor. Nip the problem in the bud when we read the wasm section. Found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3219 Differential Revision: https://reviews.llvm.org/D38777 llvm-svn: 316357
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/llvm-objdump/Inputs/corrupt-section.wasmbin0 -> 22 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/wasm-corrupt-section.test2
2 files changed, 2 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/Inputs/corrupt-section.wasm b/llvm/test/tools/llvm-objdump/Inputs/corrupt-section.wasm
new file mode 100644
index 00000000000..3bf45f715db
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/corrupt-section.wasm
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/wasm-corrupt-section.test b/llvm/test/tools/llvm-objdump/wasm-corrupt-section.test
new file mode 100644
index 00000000000..9ba7a7ef6bd
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/wasm-corrupt-section.test
@@ -0,0 +1,2 @@
+# RUN: not llvm-objdump -h %p/Inputs/corrupt-section.wasm 2>&1 | FileCheck %s
+# CHECK: '{{.*}}corrupt-section.wasm': Section too large
OpenPOWER on IntegriCloud