fkie-cad / dewolf

A research decompiler implemented as a Binary Ninja plugin.
GNU Lesser General Public License v2.1
162 stars 9 forks source link

fix self referential declarations in For Loops #312

Closed blattm closed 10 months ago

blattm commented 11 months ago

This fix prevents the ForLoopVariableRenamer from generating wrong For Loop declarations.

E.g. this code (where b is e.g. an argument or defined earlier)

b = foo(b);
while(b <= 5){
    ...  
    b = b + 1
}

will no longer be changed to

for(i = foo(i); i <= 5; i = i + 1)
    ...
}

Instead, the correct for loop declaration i = foo(b) will be created.