[PATCH] D34321: Fix overstrict validation of Mach-O rebase opcode
Dave Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 22:17:59 PDT 2017
kastiglione added inline comments.
================
Comment at: lib/Object/MachOObjectFile.cpp:3738-3740
// For rebase opcodes they can step from one section to another.
uint64_t TrailingSegOffset = (addr + i) - SI.SegmentStartAddress;
const char *error = checkSegAndOffset(SegIndex, TrailingSegOffset, false);
----------------
Note this `endInvalid = false`.
A `REBASE_OPCODE_DO_*_TIMES*` opcode is processed and leaves `SegmentOffset` pointing to the end of a section. This call to `checkSegAndOffset` allows it because of the `endInvalid = false`.
But, if the subsequent opcode is `REBASE_OPCODE_ADD_ADDR_IMM_SCALED`, then it will error on its precondition because it calls `checkSegAndOffset` with `endInvalid = true`.
https://reviews.llvm.org/D34321
More information about the llvm-commits
mailing list