[PATCH] D34321: Fix overstrict validation of Mach-O rebase opcode

Dave Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 11:12:13 PDT 2017


kastiglione planned changes to this revision.
kastiglione added a comment.

Will follow @compnerd's feedback and produce some tests.



================
Comment at: lib/Object/MachOObjectFile.cpp:2890
       error = O->RebaseEntryCheckSegAndOffset(SegmentIndex, SegmentOffset,
                                               false);
       if (error) {
----------------
Note that this is the only check that with `endInvalid = false`. Why is it valid for the offset to point to the end of a section here and only here? Could it be that the precondition and postcondition of this opcode are flipped? In other words, why is it valid for `SegmentOffset` to point to the end of a section after applying the opcode, but not before applying the opcode? Shouldn't it be the other way around?


https://reviews.llvm.org/D34321





More information about the llvm-commits mailing list