ben-sb / obfuscator-io-deobfuscator

A deobfuscator for scripts obfuscated by Obfuscator.io
https://obf-io.deobfuscate.io
Apache License 2.0
275 stars 61 forks source link

Incorrectly detecting variables as constant #16

Closed ben-sb closed 3 months ago

ben-sb commented 3 months ago

There are a few cases where variables are incorrectly detected as constant, and thus incorrectly propagated.

function test() {
  var a = 4;
  var b;
  a == 5 && (b = 10);
  console.log(b);
}

is being converted to

function test() {
  console.log(10); // incorrect constant propagation
}

and

function test(a, b, c) {
  a == 5 && (b = 10);
  console.log(b);
}

is being converted to

function test(a, b, c) {
  if (a == 5) {
    b = 10;
  }
  console.log(10); // incorrect constant propagation
}