Skip to content

Commit

Permalink
fix(javascript) final solid fix for runaway regex
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Nov 15, 2020
1 parent 743c4a2 commit dc7a81e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Expand Up @@ -22,6 +22,9 @@ New Languages:

Language Improvements:

- fix(r) fixed keywords not properly spaced (#2852) [Josh Goebel][]
- fix(javascript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
- fix(livescript) fix potential catastrophic backtracking (#2852) [Josh Goebel][]
- bug(xml) XML grammar was far too imprecise/fuzzy [Josh Goebel][]
- enh(xml) Improve precision to prevent false auto-detect positives [Josh Goebel][]
- fix(js/ts) Prevent for/while/if/switch from falsly matching as functions (#2803) [Josh Goebel][]
Expand Down
4 changes: 1 addition & 3 deletions src/languages/javascript.js
Expand Up @@ -256,9 +256,7 @@ export default function(hljs) {
regex.lookahead(regex.concat(
// we also need to allow for multiple possible comments inbetween
// the first key:value pairing
/(\/\/.*$)*/,
/(\/\*(.|\n)*\*\/)*/,
/\s*/,
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
IDENT_RE + '\\s*:'))),
relevance: 0,
contains: [
Expand Down

0 comments on commit dc7a81e

Please sign in to comment.