Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect POP semantics with relative stack pointer #455

Closed
gyorokpeter opened this issue Jan 8, 2017 · 4 comments
Closed

incorrect POP semantics with relative stack pointer #455

gyorokpeter opened this issue Jan 8, 2017 · 4 comments

Comments

@gyorokpeter
Copy link
Contributor

gyorokpeter commented Jan 8, 2017

>>> from triton import *
>>> setArchitecture(ARCH.X86)
>>> inst1 = Instruction('\xBC\x00\xFE\x19\x00')
>>> inst2 = Instruction('\xC7\x04\x24\x11\x11\x11\x11')
>>> inst3 = Instruction('\x8F\x04\x24')
>>> processing(inst1)
True
>>> processing(inst2)
True
>>> processing(inst3)
True
>>> inst1
0: mov esp, 0x19fe00
>>> inst2
0: mov dword ptr [esp], 0x11111111
>>> inst3
0: pop dword ptr [esp]
>>> for sa in inst3.getStoreAccess():
...     print hex(sa[0].getAddress())
...
0x19fe00L

The expected result is 0x19fe04L. When popping a value to an address relative to ESP, the change to ESP comes before the address resolution.

@JonathanSalwan JonathanSalwan changed the title incorrect POP semantics incorrect POP semantics with relative stack pointer Jan 8, 2017
@JonathanSalwan JonathanSalwan self-assigned this Jan 8, 2017
@JonathanSalwan JonathanSalwan added this to the v0.5 milestone Jan 8, 2017
@JonathanSalwan
Copy link
Owner

One more weird semantics undocumented into the Intel manual. Thanks!

@gyorokpeter
Copy link
Contributor Author

It is actually documented, I just checked in the manual available from the official site (https://software.intel.com/en-us/articles/intel-sdm):

If the ESP register is used as a base register for addressing a destination operand in memory, the POP instruction computes the effective address of the operand after it increments the ESP register.

@JonathanSalwan
Copy link
Owner

Indeed. My bad.

@KnoooW
Copy link

KnoooW commented Jan 9, 2017

trying modeling intel instructions is really tough job..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants