Performance Issue with resolveFunctionToArray when Dealing with Large Arrays
lanvent opened this issue · 0 comments
lanvent commented
Description:
When deobfuscating code that contains large array initializations (e.g., var item=Array(200000);
), the library becomes unresponsive for an extended period of time. The resolveFunctionToArray
function tries to expand the array to its full size, bloating the AST and causing performance issues.
Reproduce:
- Obfuscate the following code snippet using Obfuscator.io with the "Low" preset:
var item=Array(200000);
function hi() {
item[2]=3;
console.log("Hello World!");
}
- Attempt to deobfuscate the resulting code.
Possible Solutions:
- Implement a filter to skip array initializations over a certain size (e.g., 10,000 elements). If size field is a binary expression, need to evaluate to determine if it should be skipped.
- Add a timeout feature to
resolveFunctionToArray
. - Limit the maximum size of an array that can be expanded in the AST.
I am not certain which approach is best, and would appreciate input from more experienced contributors like you.
Thanks again for developing such an excellent tool. Looking forward to future improvements.