[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 12:38:03 PST 2022


oontvoo requested review of this revision.
oontvoo marked an inline comment as done.
oontvoo added inline comments.


================
Comment at: llvm/lib/Object/MachOObjectFile.cpp:234
+  // done somewhere else (earlier).
+  uint32_t LoadCmdsEnd = llvm::SaturatingAdd<uintptr_t>(
+      reinterpret_cast<uintptr_t>(Obj.getData().data()), HeaderSize,
----------------
tschuett wrote:
> I am known to be stupid. You do saturating add with `uintptr_t` and claim errors on `uint32_t`?
> 
> Would it help to make the asserts into real errors? I like to be informed about malformed files in release builds.
oops, sorry - forgot to update the error messages when I updated the types.
yes - can make these errors instead of asserts.


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