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

transformObjectKeys and single statement braceless blocks #387

Closed
kluns opened this issue May 9, 2019 · 0 comments · Fixed by #479
Closed

transformObjectKeys and single statement braceless blocks #387

kluns opened this issue May 9, 2019 · 0 comments · Fixed by #479

Comments

@kluns
Copy link

kluns commented May 9, 2019

Using transformObjectKeys converts some single statement assignments into multiple statements. When this occurs in a single statement if block without braces no braces are added to keep the full assignment in the if block. This can cause undefined object errors.

Expected Behavior

This code should not have errors when the condition is false:

function hi() {
  var i = 1;
  tstArray = new Array(0);
  if (i === 0)
    tstArray[0] = {state1: "on", state2: "off"};
  i += 1;
}
hi();

Current Behavior

function hi() {
    var _0x106765 = 0x1;
    tstArray = new Array(0x0);
    if (_0x106765 === 0x0)
        tstArray[0x0] = {};
    tstArray[0x0]['state1'] = 'on';
    tstArray[0x0]['state2'] = 'off';
    _0x106765 += 0x1;
}
hi();

Steps to Reproduce (for bugs)

  1. fails on https://obfuscator.io/

Your Environment

  • Obfuscator version used:
  • Node version used:

Stack trace

Minimal working example that will help to reproduce issue

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

Successfully merging a pull request may close this issue.

2 participants