Skip to content

Commit 81e44c5

Browse files
authored
fix(Deobfuscator): return if Node is null in extractCounterIdentifiers (#296)
1 parent b69ced9 commit 81e44c5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Deobfuscator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export class Deobfuscator {
6363
* @param {*} node
6464
*/
6565
#extractCounterIdentifiers(nc, node) {
66+
if (node === null) {
67+
return;
68+
}
6669
const { type } = nc;
6770

6871
switch (type) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Import Node.js Dependencies
2+
import { test } from "node:test";
3+
4+
// Import Internal Dependencies
5+
import { AstAnalyser } from "../../index.js";
6+
7+
/**
8+
* @see https://github.com/NodeSecure/js-x-ray/issues/295
9+
*/
10+
test("Deobfuscator.#extractCounterIdentifiers should not throw if FunctionDeclaration id is null", () => {
11+
new AstAnalyser().analyse(`
12+
export default async function (app) {
13+
app.loaded = true
14+
}
15+
`);
16+
});

0 commit comments

Comments
 (0)