[PATCH] D38777: [wasm] readSection: Avoid reading past eof (fixes oss-fuzz #3219)

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 12:36:13 PDT 2017


sbc100 added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:190
   Ptr += Size;
+  if (Ptr > Eof)
+    return make_error<StringError>("Section too large",
----------------
Perhaps do this before the ArrayRef is created and before Ptr is incremented?

`if (Ptr + Size > Eof) `


================
Comment at: test/tools/llvm-dwarfdump/X86/fuzzer.test:2
+RUN: not llvm-dwarfdump %S/Inputs/oss-fuzz-3219 2>&1 | FileCheck --check-prefix=FUZZ3219 %s
+FUZZ3219: oss-fuzz-3219: Invalid data was encountered while parsing the file
----------------
Any reason this lives in 'X86'?


https://reviews.llvm.org/D38777





More information about the llvm-commits mailing list