Semgrep: [javascript] Match error on variable declaration

Created on 26 May 2020  路  7Comments  路  Source: returntocorp/semgrep

Describe the bug
an internal error occured while invoking the semgrep engine: unknown exception: (Failure
"NoTokenLocation min_max, empty list exn while processing ./foundation.min.js for rule 13..3, with metavar $Y, close location = { \"line\": 9, \"col\": 7894, \"offset\": 8136 }").

To Reproduce
With this file: https://github.com/daghan/lets-be-bad-guys/blob/master/badguys/static/js/foundation.min.js

semgrep --config https://semgrep.live/r/javascript foundation.min.js

Environment
Repro'ed with semgrep (brew) v0.8, semgrep GH action and semgrep.live

bug duplicate fixed javascript high

All 7 comments

@aryx @ievans Any relation to recent bug fixes? I suspect this interferes with our demos.

@daghan Is there an unminified version of this file somewhere we can play with?

FWIW, I beautified this using beautify-js, and the offending lines of the file are:

var r = function(e) {
   return /blackout/.test(e.selector) ? e : e.closest(".clearing-blackout")
}(e(n)), i, s;

https://semgrep.live/APp for an online version

A simpler repro is at: https://semgrep.live/DBY

Note that ./pfff -dump_js parses the latter example successfully.

I think I've fixed that yesterday.
Same than https://github.com/returntocorp/semgrep/issues/824

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brendongo picture brendongo  路  5Comments

ajinabraham picture ajinabraham  路  6Comments

disconnect3d picture disconnect3d  路  5Comments

DrewDennison picture DrewDennison  路  4Comments

nbrahms picture nbrahms  路  5Comments