PerimeterX / restringer

A Javascript Deobfuscator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prevent Replacement of Proxies with Update Expressions

BenBaryoPX opened this issue · comments

Assignments where the right side contains an update expression should not be treated as proxied replacements, but as static values.
For example:

const a = [1, 2, 3, 4];
let i = 0;
const b = a[i++];
for (let _ of a) console.log(b);

This should print 1 four times.

However, after deobfuscation, the resulting code looks like this:

const a = [
  1,
  2,
  3,
  4
];
let i = 0;
const b = a[i++];
for (let _ of a)
  console.log(a[i++]);

And prints 2, 3, 4.

I've mentioned assignments, but the same goes for variable declarators and their init.

In the expected fixed behvaior variable b should not be replaced with its init value.