Skip to content

Commit

Permalink
Fix/Trampoline rel jmp check (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
cursey authored Jan 2, 2025
1 parent de83823 commit 85155dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/inline_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ std::expected<void, InlineHook::Error> InlineHook::e9_hook(const std::shared_ptr
auto new_disp = target_address - (tramp_ip + 6);

// Handle the case where the target is now in the trampoline.
if (target_address < m_target + m_original_bytes.size()) {
if (target_address >= m_target && target_address < m_target + m_original_bytes.size()) {
new_disp = static_cast<ptrdiff_t>(ix.raw.imm[0].value.s);
}

Expand All @@ -275,7 +275,7 @@ std::expected<void, InlineHook::Error> InlineHook::e9_hook(const std::shared_ptr
auto new_disp = target_address - (tramp_ip + 5);

// Handle the case where the target is now in the trampoline.
if (target_address < m_target + m_original_bytes.size()) {
if (target_address >= m_target && target_address < m_target + m_original_bytes.size()) {
new_disp = static_cast<ptrdiff_t>(ix.raw.imm[0].value.s);
}

Expand Down

0 comments on commit 85155dd

Please sign in to comment.