Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controlFlowFlattening seems to ignore continue in while or for loop #71

Closed
jpodpro opened this issue Jul 26, 2017 · 7 comments
Closed

Comments

@jpodpro
Copy link

jpodpro commented Jul 26, 2017

i've got a while loop with a condition that calls continue. when controlFlowFlattening is enabled (threshold is at 0.75) the condition is reached but continue does not appear to be called. the lines of code after are called instead of the loop restarting. I have also discovered this happening in a for loop elsewhere in my code.

while (link_it.next())
{
      var pkt = link_it.value.getPacketFrom();
      if (!pkt)
      {
            pkt = link_it.value.getPacketTo();
      }
      if (!pkt)
      {
            console.log('there is no packet');
            continue;
      }

      console.log('packet is', pkt);
      var src = pkt.src;
      var dst = pkt.dst;
}

the console shows:

there is no packet
packet is null

here are my obfuscation options:

    --compact true
    --controlFlowFlattening true
    --controlFlowFlatteningThreshold 0.75
    --deadCodeInjection true
    --deadCodeInjectionThreshold 0.4
    --debugProtection false
    --debugProtectionInterval false
    --disableConsoleOutput false
    --mangle false
    --rotateStringArray true
    --selfDefending true
    --stringArray true
    --stringArrayEncoding 'base64'
    --stringArrayThreshold 0.75
    --unicodeEscapeSequence false
@sanex3339 sanex3339 added the bug label Jul 26, 2017
@sanex3339
Copy link
Member

Thank you for bug report. I will see into this tomorrow.

@jpodpro
Copy link
Author

jpodpro commented Jul 26, 2017

as expected, with a lower threshold sometimes it happens and sometimes not. when threshold is set to 1 it always happens.

@sanex3339
Copy link
Member

sanex3339 commented Jul 26, 2017

I know why this happens. When obfuscator using one of type of control flow flattening - he skiping all statements with continue or break. And i forgot to add WhileStatement node.

@sanex3339
Copy link
Member

sanex3339 commented Jul 26, 2017

Previous comment was wrong, problem was in other place, but looks like i fixed it.
Expect new beta version tomorrow, and if in this version won't contain new bugs - i release stable version.

@sanex3339 sanex3339 added this to the 0.10.0 milestone Jul 26, 2017
@sanex3339 sanex3339 reopened this Jul 26, 2017
@sanex3339
Copy link
Member

Hi. Check new beta javascript-obfuscator@0.10.0-beta.12.

I'll release stable version later today.

@jpodpro
Copy link
Author

jpodpro commented Jul 27, 2017

thanks!

@sanex3339
Copy link
Member

0.10.0 is out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants