OSDN Git Service

[wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)
authorVedant Kumar <vsk@apple.com>
Mon, 23 Oct 2017 18:04:34 +0000 (18:04 +0000)
committerVedant Kumar <vsk@apple.com>
Mon, 23 Oct 2017 18:04:34 +0000 (18:04 +0000)
commitf9ce75bf1830d5488211ede06be71d08c694dcf3
tree86ae4e7be4869a49d38d0b7029d8d16d527b0866
parent3e1218f32a495fcfcded23b167f9d39cb01b0655
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316357 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Object/WasmObjectFile.cpp
test/tools/llvm-objdump/Inputs/corrupt-section.wasm [new file with mode: 0644]
test/tools/llvm-objdump/wasm-corrupt-section.test [new file with mode: 0644]