File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1+ v4.10.1
2+ =======
3+
4+ * #361: Avoid potential REDoS in ``EntryPoint.pattern ``.
5+
16v4.10.0
27=======
38
Original file line number Diff line number Diff line change @@ -34,3 +34,12 @@ def uncached_distribution_perf():
3434 # end warmup
3535 importlib .invalidate_caches ()
3636 importlib_metadata .distribution ('ipython' )
37+
38+
39+ def entrypoint_regexp_perf ():
40+ import importlib_metadata
41+ import re
42+
43+ input = '0' + ' ' * 2 ** 10 + '0' # end warmup
44+
45+ re .match (importlib_metadata .EntryPoint .pattern , input )
Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ class EntryPoint(DeprecatedTuple):
161161
162162 pattern = re .compile (
163163 r'(?P<module>[\w.]+)\s*'
164- r'(:\s*(?P<attr>[\w.]+))? \s*'
165- r'(?P<extras>\[.*\])? \s*$'
164+ r'(:\s*(?P<attr>[\w.]+)\s*)? '
165+ r'(( ?P<extras>\[.*\])\s*)? $'
166166 )
167167 """
168168 A regular expression describing the syntax for an entry point,
You can’t perform that action at this time.
0 commit comments