This is an archive of the discontinued LLVM Phabricator instance.

[MachO] Add out-of-bounds check to MachOObjectFile.cpp
ClosedPublic

Authored by sbc100 on May 30 2018, 10:11 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

sbc100 created this revision.May 30 2018, 10:11 AM
thegameg accepted this revision.Jun 4 2018, 9:20 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 4 2018, 9:20 AM
JDevlieghere added inline comments.
lib/Object/MachOObjectFile.cpp
110 ↗(On Diff #149152)

Is the goal to ensure the caller did the check or should we make this a runtime check?

thegameg added inline comments.Jun 4 2018, 9:34 AM
lib/Object/MachOObjectFile.cpp
110 ↗(On Diff #149152)

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.

JDevlieghere added inline comments.Jun 4 2018, 9:37 AM
lib/Object/MachOObjectFile.cpp
110 ↗(On Diff #149152)

Alright, I was worried this might trigger in OSS-fuzz but it sounds like an assertion is what we want here. Thanks for confirming!

This revision was automatically updated to reflect the committed changes.