Skip to content

Missing context in Rust binary_op_lifter! to check for correct size of expressions #5913

Open
@fuzyll

Description

@fuzyll

Version and Platform (required):

  • Binary Ninja Version: 4.2.6025-dev

Bug Description:
In the Rust API, there are macros like binary_op_lifter! that are very strict about size checking. If you get it wrong, it will print something like this as a warning each time it's lifted incorrectly:

il @ {:x} attempted to lift 4 byte expression builder as 0 bytes

This is very helpful when you are lifting as it can help you catch potential errors. Unfortunately, it's incredibly pedantic and isn't expressive enough for certain architectures. This means you can wind up with a ton of these messages and no way to resolve them when lifting.

The best example of this is in C-SKY comparison instructions (cmp_{e,ne,slt,ult...}) where binary_op_lifter! treats the two source expressions and the destination instruction as the same size. This works in a lot of cases, but here the output of the cmp is fed into a set_flag operation that expects a size of 0. As a result, the warning is completely unavoidable.

Metadata

Metadata

Assignees

Labels

Component: Rust APIIssue needs changes to the Rust APIEffort: MediumIssue should take < 1 monthImpact: HighIssue adds or blocks important functionality

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions