[PATCH] D47544: [MachO] Add out-of-bounds check to MachOObjectFile.cpp
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 09:35:07 PDT 2018
thegameg added inline comments.
================
Comment at: lib/Object/MachOObjectFile.cpp:110
static const char *getPtr(const MachOObjectFile &O, size_t Offset) {
+ assert(Offset <= O.getData().size());
return O.getData().data() + Offset;
----------------
JDevlieghere wrote:
> Is the goal to ensure the caller did the check or should we make this a runtime check?
To ensure the caller does the check and didn't rely on the behavior of `StringRef::substr` from https://reviews.llvm.org/rL333496. I don't think it's worth making it a runtime check.
Repository:
rL LLVM
https://reviews.llvm.org/D47544
More information about the llvm-commits
mailing list