Skip to content

Commit

Permalink
fix(Deobfuscator): return if Node is null in extractCounterIdentifiers (
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken authored Aug 16, 2024
1 parent b69ced9 commit 81e44c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Deobfuscator.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export class Deobfuscator {
* @param {*} node
*/
#extractCounterIdentifiers(nc, node) {
if (node === null) {
return;
}
const { type } = nc;

switch (type) {
Expand Down
16 changes: 16 additions & 0 deletions test/issues/295-deobfuscator-function-declaration-id-null.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Import Node.js Dependencies
import { test } from "node:test";

// Import Internal Dependencies
import { AstAnalyser } from "../../index.js";

/**
* @see https://github.com/NodeSecure/js-x-ray/issues/295
*/
test("Deobfuscator.#extractCounterIdentifiers should not throw if FunctionDeclaration id is null", () => {
new AstAnalyser().analyse(`
export default async function (app) {
app.loaded = true
}
`);
});

0 comments on commit 81e44c5

Please sign in to comment.