What is the feature you'd like to have?
When identifying the loop region, consider reverse the condition to choose anorther node when the node is too large or the max indentation level inside the node is too high; When the node is small or the max indentation level inside the node is low, embed the loop region. This helps to convert certain while (true) loop into do-while loop, reduce indentation levels, and improve readability.
Is your feature request related to a problem?
It seems that BN is too inclined to generate while loops. I found that in the following situation, BN(Personal 4.1.5747-Stable) generates complex while (true) loops, while IDA generates do-while loops, significantly reducing complexity:
In BN debug report, the above area will be identified as the following loop region:
Eventually, a frustrating while (true) loop was generated, causing the majority of the code following the function to have an extra indentation level😢:
In my personal opinion, when identifying the loop body, if the conditional node(as shown in the blue border, the default branch is true) points to a node that is too large, the condition should be reversed or the branch should be switched into false to select other smaller node. If the node pointed to by the branch is small, it can be considered to include it in the loop body instead of using the default break statement. At the same time, adding more diverse loop structure pattern matching should be able to correctly transform this situation.
Are any alternative solutions acceptable?
Does BN seem to not support user intervention in its control flow structuring process?🥲
Additional Information:
Here is the sample(also a CTF chall lol), which main funcstion contains this situation.
vmquacks_combinator.zip
What is the feature you'd like to have? When identifying the loop region, consider reverse the condition to choose anorther node when the node is too large or the max indentation level inside the node is too high; When the node is small or the max indentation level inside the node is low, embed the loop region. This helps to convert certain
while (true)
loop intodo-while
loop, reduce indentation levels, and improve readability.Is your feature request related to a problem? It seems that BN is too inclined to generate
while
loops. I found that in the following situation, BN(Personal 4.1.5747-Stable) generates complexwhile (true)
loops, while IDA generatesdo-while
loops, significantly reducing complexity: In BN debug report, the above area will be identified as the following loop region: Eventually, a frustratingwhile (true)
loop was generated, causing the majority of the code following the function to have an extra indentation level😢: In my personal opinion, when identifying the loop body, if the conditional node(as shown in the blue border, the default branch istrue
) points to a node that is too large, the condition should be reversed or the branch should be switched intofalse
to select other smaller node. If the node pointed to by the branch is small, it can be considered to include it in the loop body instead of using the defaultbreak
statement. At the same time, adding more diverse loop structure pattern matching should be able to correctly transform this situation.Are any alternative solutions acceptable? Does BN seem to not support user intervention in its control flow structuring process?🥲
Additional Information: Here is the sample(also a CTF chall lol), which
main
funcstion contains this situation. vmquacks_combinator.zip