Skip to content

Possibly wrong decompilation of switch statements #256

@ceeac

Description

@ceeac

Boomerang version:
v0.5.1 (d4d9aea)

Steps to reproduce:

  1. Decompile an executable containing a switch statement that is propagated to

Additional comments:
When decompiling an executable containing a switch statement, the following may happen:

  1. The RTL for the switch statement is created. After conversion to SSA form, the computed jump from the switch statement references statement a.
  2. Statement propagation is applied. The computed jump now contains a reference to statement b.
  3. After switch/case analysis, the switch expression is saved by IFrontEnd::saveDecodedRTL.
  4. The whole CFG is re-created. When re-creating the RTL for the switch statement, the previously-saved RTL referencing statement b is re-loaded. This is a different statement and after propagation the switch expression may be different from before re-decoding, which is incorrect.

The best solution would be to separate disassembly and lifting of instructions and just clearing and re-lifting the IR for each machine instruction after analyzing switch statements and other computed CTIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug(I) Something is not working as intended

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions