From b551071cdcc9dcdd7782c31ee19c9ba6ec146b22 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 17 Jul 2015 11:00:04 +0000 Subject: [PATCH] fix infinite loop in acorn_loose when parsing broken import --- node_modules/treehugger/lib/acorn/dist/acorn_loose.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node_modules/treehugger/lib/acorn/dist/acorn_loose.js b/node_modules/treehugger/lib/acorn/dist/acorn_loose.js index e5974e32..a643d442 100644 --- a/node_modules/treehugger/lib/acorn/dist/acorn_loose.js +++ b/node_modules/treehugger/lib/acorn/dist/acorn_loose.js @@ -1146,6 +1146,7 @@ lp.parseImportSpecifierList = function () { this.pushCx(); this.eat(tt.braceL); if (this.curLineStart > continuedLine) continuedLine = this.curLineStart; + var lastTokenStart = -1; while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) { var elt = this.startNode(); if (this.eat(tt.star)) { @@ -1157,6 +1158,8 @@ lp.parseImportSpecifierList = function () { elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported; this.finishNode(elt, "ImportSpecifier"); } + if (elt.start == lastTokenStart) break; + lastTokenStart = elt.start; elts.push(elt); this.eat(tt.comma); }