[PATCH] D47544: [MachO] Add out-of-bounds check to MachOObjectFile.cpp
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 09:40:21 PDT 2018
JDevlieghere 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;
----------------
thegameg wrote:
> 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.
Alright, I was worried this might trigger in OSS-fuzz but it sounds like an assertion is what we want here. Thanks for confirming!
Repository:
rL LLVM
https://reviews.llvm.org/D47544
More information about the llvm-commits
mailing list