[PATCH] D47046: [WebAssembly] Object: Add more error checking for object file reading

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 10:14:02 PDT 2018


sbc100 added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:961
     uint32_t Size = readVaruint32(Ptr);
+    if (Size > End - Ptr)
+      return make_error<GenericBinaryError>("Invalid segment size",
----------------
jfb wrote:
> That seems like readvaruint32 went out of valid range, no?
This means the reported segment size would make it go off the end of the data section.

The absolute value of `Size` could still be small.


Repository:
  rL LLVM

https://reviews.llvm.org/D47046





More information about the llvm-commits mailing list