simonlindholm / asm-differ

Assembly diff script
The Unlicense
101 stars 50 forks source link

Fix indirect calls like calll *0x123456 #125

Closed roblabla closed 1 year ago

roblabla commented 1 year ago

This would fail on calll *0x123456 instructions with an exception claiming it failed to parse *0x123456 as an int because of the prefixed star.

I'm not sure if this fix is correct - I have absolutely no clue what much of the code in here is trying to do. But it does allow the differ to continue.

simonlindholm commented 1 year ago

I have little idea also. But it seems reasonable.

Now the code tries first to search for r"\*(.*)\(", and then r"\*(.*)" as a fallback if it fails, performing the same logic if either matches. But the second should imply the first, so can we just get rid of the first check?

roblabla commented 1 year ago

You'd think so, but actually no! I initially did that as well, but it broke on instructions of the form whatever *0x12(%eax), because now we would try to run int("0x12(%eax)", 16) which is also wrong ^^.

simonlindholm commented 1 year ago

Ah! Maybe we can do \*([0-9x]+)?

roblabla commented 1 year ago

hmm, yeah that might work