Skip to content

Commit

Permalink
Make sure to zero gas sub immediate
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Dec 9, 2024
1 parent 00ee2ad commit 9a58634
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lfi-postlink/amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ meterupdate(uint8_t* code, size_t size, size_t addr)
assert(ret == 8);
memset(&code[count + 4], 0, 4);
}
if (FD_TYPE(&instr) == FDI_SUB && FD_OP_REG(&instr, 0) == FD_REG_R12) {
assert(ret == 7);
memset(&code[count + 3], 0, 4);
}
bool indirect, cond;
int64_t target;
bool branch = branchinfo(addr+count, &instr, &target, &indirect, &cond);
Expand Down

0 comments on commit 9a58634

Please sign in to comment.