summaryrefslogtreecommitdiff
path: root/pygments/lexers/javascript.py
diff options
context:
space:
mode:
authorJean Abou-Samra <jean@abou-samra.fr>2022-09-15 15:02:04 +0200
committerGitHub <noreply@github.com>2022-09-15 15:02:04 +0200
commit513f8fc34f7ec915994ac226ff333b2f6864b54c (patch)
treee296217f4c859a228ea104536fb0c73391edce07 /pygments/lexers/javascript.py
parent472563a5dc68785a1015a712138e83d838eda238 (diff)
downloadpygments-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.py2
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