MichaelXF / js-confuser

JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
https://js-confuser.com
MIT License
168 stars 28 forks source link

Control Flow Flattening breaks function declaration in non-executed switch case block #86

Open MichaelXF opened 1 year ago

MichaelXF commented 1 year ago

Config and Small code sample

Config:

{
  target: "node",
  controlFlowFlattening: true
}

Code:

switch (true) {
  case false:
    function myFunction() { // This block is never ran, but declaration is still able to be called
      console.log("Hello World!");
    }
    break;

  case true:
    myFunction();
    break;
}

var filler1;
var filler2;
// "Hello World"

Expected behavior

The program should output "Hello World"

Actual behavior

TypeError: (intermediate value)(intermediate value) is not a function