diff options
author | Jean Abou-Samra <jean@abou-samra.fr> | 2022-09-15 15:02:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 15:02:04 +0200 |
commit | 513f8fc34f7ec915994ac226ff333b2f6864b54c (patch) | |
tree | e296217f4c859a228ea104536fb0c73391edce07 /pygments/lexers/javascript.py | |
parent | 472563a5dc68785a1015a712138e83d838eda238 (diff) | |
download | pygments-git-513f8fc34f7ec915994ac226ff333b2f6864b54c.tar.gz |
Objective-J: fix catastrophic backtracking in comment regex (#2225)
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.
Diffstat (limited to 'pygments/lexers/javascript.py')
-rw-r--r-- | pygments/lexers/javascript.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index 1896fb46..864a9043 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -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 |