phylum-dev / vuln-reach

A library for building tools to determine if vulnerabilities are reachable in a code base.

Home Page:https://phylum.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip processing modules with parse errors

andreaphylum opened this issue · comments

Sometimes, there are modules which result in a parse error. tree-sitter will not error out but will recognize those as errors and mark the nodes accordingly.
Those may not be genuine bugs, but will result in breaking our assumptions.

We should detect and skip those modules, whereas currently we panic (see #26).

How to reproduce

QUnit intro.js

Try loading this as a module. It will result in a panic. Note that the node is marked as ERROR.

thread 'main' panicked at '{Node ERROR (11, 0) - (11, 21)} (function( window ) {', /home/andrea/phylum/repos/vuln-reach/vuln-reach/vuln-reach/src/javascript/lang/symbol_table.rs:283:17

vkbeautify

This module is also affected by the same issue.

thread 'main' panicked at '{Node ERROR (47, 0) - (356, 5)}, ...