[PATCH] D50387: [WASM] Fix overflow when reading custom section

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 09:31:04 PDT 2018


sbc100 added inline comments.


================
Comment at: llvm/lib/Object/WasmObjectFile.cpp:222
+    const uint32_t NameLength = Ctx.Ptr - NameStart;
+    if (NameLength > Size)
+      return make_error<StringError>(
----------------
JDevlieghere wrote:
> Can this section be empty? (i.e. should I make this greater or equal)
I think the ReadContext is probably a better way to enforce this.  readString already does this check based on the context.

This check seems a little strange since it reads the string before checking if its too long.



Repository:
  rL LLVM

https://reviews.llvm.org/D50387





More information about the llvm-commits mailing list