GaloisInc / macaw

Open source binary analysis tools.
BSD 3-Clause "New" or "Revised" License
208 stars 21 forks source link

macaw-x86: Fix `call` semantics when call target involves the stack pointer #421

Closed RyanGlScott closed 3 months ago

RyanGlScott commented 3 months ago

Previously, the macaw-x86 semantics for call would retrieve the call target after pushing the next instruction's address to the stack, but if the call target involves the stack pointer, then this would mean that it would get the next instruction's address when retrieving the call target. This is not what is intended!

This patch fixes the issue by always retrieving the call target before pushing the next instruction's address to the stack. I have added a test case to the macaw-x86-symbolic test suite which demonstrates that this fix works as intended.

Fixes #420.

Ptival commented 3 months ago

Nice catch!