Skip to content

Commit

Permalink
Objective-J: fix catastrophic backtracking in comment regex (#2225)
Browse files Browse the repository at this point in the history
This use of *? was both incorrect and catastrophically backtracking
when embedding this regex into a larger regex with a trailing pattern,
since it could match much more than intended and try exponentially
many positions in that process.
  • Loading branch information
jeanas committed Sep 15, 2022
1 parent 472563a commit 513f8fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pygments/lexers/javascript.py
Expand Up @@ -801,7 +801,7 @@ class ObjectiveJLexer(RegexLexer):
mimetypes = ['text/x-objective-j']

#: optional Comment or Whitespace
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)*'
_ws = r'(?:\s|//[^\n]*\n|/[*](?:[^*]|[*][^/])*[*]/)*'

flags = re.DOTALL | re.MULTILINE

Expand Down

0 comments on commit 513f8fc

Please sign in to comment.