google / binexport

Export disassemblies into Protocol Buffers
Apache License 2.0
1.03k stars 197 forks source link

Error in parsing SUB r/m64, imm32 #5

Closed grotrek closed 8 years ago

grotrek commented 8 years ago

For example: There is instruction in IDA "sub rsp, 0F8h" with opcode "48 81 EC F8 00 00 00", but after export to Binnavi it converts to "sub qword rsp, 0h" example of idb file, source and binary attached: sub_bug.zip

This instruction is in function "test" with address 004004FA

cblichmann commented 8 years ago

Confirmed, see attached text dump file sub_bug.txt, line 195:

004004FA sub rsp, b4 0

This behavior is also in zynamics_binexport_8.

cblichmann commented 8 years ago

Fixed in 626e803. The code in ida/metapc.cc's HandleImmediate() relied on undefined behavior when undoing IDA's sign extension.