dpnishant / jsprime

a javascript static security analysis tool
http://dpnishant.github.io/jsprime
Other
585 stars 103 forks source link

Odd error message #24

Open Hax0rG1rl opened 6 years ago

Hax0rG1rl commented 6 years ago

Hi there,

Trying to check a simple JS file I got this error:

/jsprime/jsprime-node/engine.js:1530
            if (node2.argument.name != undefined)
                               ^

TypeError: Cannot read property 'name' of null
    at /jsprime/jsprime-node/engine.js:1530:32
    at traverseMini (/jsprime/jsprime-node/engine.js:84:3)
    at /jsprime/jsprime-node/engine.js:92:13
    at Array.forEach (<anonymous>)
    at traverseMini (/jsprime/jsprime-node/engine.js:91:17)
    at traverseMini (/jsprime/jsprime-node/engine.js:95:11)
    at /jsprime/jsprime-node/engine.js:92:13
    at Array.forEach (<anonymous>)
    at traverseMini (/jsprime/jsprime-node/engine.js:91:17)
    at getFunctions (/jsprime/jsprime-node/engine.js:1527:9)

Any ideas how to solve this?

Regards.

TejaswiniU commented 4 years ago

I hope by now you would have got the solution If not change if (node2.argument.name != undefined) to if (node2.argument!=undefined & node2.argument.name != undefined)

Reason : By the error msg its simple that when traversing through AST there are cases where the node may have a null argument. Since we are trying for name object it is throwing error.