-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Expected Behavior
output: Hello
Current Behavior
VM118:3 Uncaught TypeError: Cannot read property 'name' of null
at <anonymous>:3:25
Steps to Reproduce
Your Environment
- Obfuscator version used:
2.9.1
- Node version used:
v14.15.0
Stack trace
VM118:3 Uncaught TypeError: Cannot read property 'name' of null
at <anonymous>:3:25
Minimal working example that will help to reproduce issue
let info = null;
const test = () => ({
name: info.name,
});
info = { name: "Hello" };
console.log(test().name);
Code after obfuscation
let info = null;
const _0x1ed649 = {};
_0x1ed649['name'] = info['name'];
const test = () => _0x1ed649;
const _0x5d0656 = {};
_0x5d0656['name'] = 'Hello';
info = _0x5d0656;
console['log'](test()['name']);
The code of the arrow function should not be moved outside, but normal functions will not cause this problem.
let info = null;
const test = function () {
return {
name: info.name,
};
};
info = { name: "Hello" };
console.log(test().name);
// after obfuscation
let info = null;
const test = function () {
const _0xce0ef3 = {};
_0xce0ef3['name'] = info['name'];
return _0xce0ef3;
};
const _0x4a2275 = {};
_0x4a2275['name'] = 'Hello';
info = _0x4a2275;
console['log'](test()['name']);