dewolf icon indicating copy to clipboard operation
dewolf copied to clipboard

[Hungarian Notation] Variables with different names but same labels are renamed to the same variable.

Open mari-mari opened this issue 1 year ago • 3 comments

What happened?

Variables with different names but same labels are renamed to the same variable.

Consider the following test, that currently fails:

    def test_same_variable_idx():
    """Variables can be copies of the same one. The renamer should only rename a variable once. (More times would destroy   the actual name)"""
        true_value = LogicCondition.initialize_true(LogicCondition.generate_new_context())
        var1 = Variable("x_1", Integer.int32_t())
        var2 = Variable("y_1", Integer.int32_t())
        ast = AbstractSyntaxTree(CodeNode([
            Assignment(var1, Constant(0)),
            Assignment(var2, Constant(0))], true_value), {})
        _run_vng(ast, _generate_options())
        assert var1._name != var2._name

In this case different variables (x_1 and y_1) should become different names, despite having same label. However, they both of them are named var_1.

How to reproduce?

Add the test above and run it. The test fails currently.

Affected Binary Ninja Version(s)

3.4.4271

mari-mari avatar Aug 09 '23 12:08 mari-mari