Skip to content

Commit 64280be

Browse files
committed
fix(javascript) final solid fix for runaway regex
1 parent ebaf171 commit 64280be

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ New Languages:
2222

2323
Language Improvements:
2424

25+
- fix(r) fixed keywords not properly spaced (#2852) [Josh Goebel][]
26+
- fix(javascript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
27+
- fix(livescript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
2528
- bug(xml) XML grammar was far too imprecise/fuzzy [Josh Goebel][]
2629
- enh(xml) Improve precision to prevent false auto-detect positives [Josh Goebel][]
2730
- fix(js/ts) Prevent for/while/if/switch from falsly matching as functions (#2803) [Josh Goebel][]

src/languages/javascript.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,7 @@ export default function(hljs) {
256256
regex.lookahead(regex.concat(
257257
// we also need to allow for multiple possible comments inbetween
258258
// the first key:value pairing
259-
/(\/\/.*$)*/,
260-
/(\/\*(.|\n)*\*\/)*/,
261-
/\s*/,
259+
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
262260
IDENT_RE + '\\s*:'))),
263261
relevance: 0,
264262
contains: [

0 commit comments

Comments
 (0)