[PATCH] D138830: [llvm] Check for overflows when computing load-command's addresses.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 10:27:23 PST 2022


oontvoo marked 2 inline comments as done.
oontvoo added inline comments.


================
Comment at: llvm/lib/Object/MachOObjectFile.cpp:202
+    if (Overflowed ||
+        Ret > reinterpret_cast<long unsigned int>(Obj.getData().end()))
       return malformedError("load command " + Twine(LoadCommandIndex) +
----------------
tschuett wrote:
> alexander-shaposhnikov wrote:
> > nit: I'd probably report a separate message for the overflow case (cause it'd make debugging a tiny bit easier)
> nit: could you instead use an integer with a defined bit width: uint64_t?
> nit: could you instead use an integer with a defined bit width: uint64_t?

How about `uintptr_t` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138830/new/

https://reviews.llvm.org/D138830



More information about the llvm-commits mailing list