Skip to content

Commit 149df3e

Browse files
committed
Fix rare off-by-one bug.
Causes an extraneous page of padding, leading to conflicts with other address space allocations.
1 parent 3ac58c9 commit 149df3e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/e9patch/e9api.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ static void parseReserve(Binary *B, const Message &msg)
634634
length = getTrampolineSize(B, bytes, nullptr);
635635
size_t length_lo = address % PAGE_SIZE;
636636
size_t length_hi = PAGE_SIZE - (length_lo + length) % PAGE_SIZE;
637+
length_hi = (length_hi == PAGE_SIZE? 0: length_hi);
637638
intptr_t address_lo = address - length_lo;
638639
intptr_t address_hi = address + length;
639640
const unsigned num_trampolines = 3;

0 commit comments

Comments
 (0)