Skip to content

Logic error when using spread operator #797

Closed

Description

@spoonysnail

Minimal working example that will help to reproduce issue

const demo = { active: true, name: 'demo' }
console.log({
      active: false,
      ...demo
})

Expected Behavior

Output: { active: true, name: 'demo' }

Current Behavior

Output: { active: false, name: 'demo' }

Your Environment

  • Obfuscator version used: 2.6.3
  • Node version used: v12.13.1

Code After Obfuscation:

const _0x41674a={..._0x5b345c};
_0x41674a[_0x22a0ec('0x17')]=![], console['log'](_0x41674a);}

Clearly, the order of assignment is wrong.

Activity

  1. changed the title [-]Obfuscate code contains spread operator may cause logical error [/-] [+]Logic error when using spread operator[/+] on Nov 3, 2020
  2. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    Hi. What options did you use?

  3. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    This bug reproduced with transformObjectKeys option is enabled.

  4. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    Seems I fixed it. PR will be ready in 30 minutes.
    After the fix, all object members previous to spread element will be ignored.

  5. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    That's sad that this bug has existed for so long.

  6. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    Will be released as 2.6.4 later today

  7. sanex3339 commented on Nov 3, 2020

    @sanex3339
    Member

    Released

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions