Skip to content

Commit 88f02bc

Browse files
committed
Fixed potential DoS attack via WHEEL_INFO_RE
1 parent e9f7a60 commit 88f02bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/news.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Release Notes
99
- The handling of ``license_files`` (including glob patterns and default
1010
values) is now delegated to ``setuptools>=57.0.0`` (#466).
1111
The package dependencies were updated to reflect this change.
12+
- Fixed potential DoS attack via the ``WHEEL_INFO_RE`` regular expression
1213

1314
**0.37.1 (2021-12-22)**
1415

src/wheel/wheelfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# Non-greedy matching of an optional build number may be too clever (more
1717
# invalid wheel filenames will match). Separate regex for .dist-info?
1818
WHEEL_INFO_RE = re.compile(
19-
r"""^(?P<namever>(?P<name>.+?)-(?P<ver>.+?))(-(?P<build>\d[^-]*))?
20-
-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)\.whl$""",
19+
r"""^(?P<namever>(?P<name>[^-]+?)-(?P<ver>[^-]+?))(-(?P<build>\d[^-]*))?
20+
-(?P<pyver>[^-]+?)-(?P<abi>[^-]+?)-(?P<plat>[^.]+?)\.whl$""",
2121
re.VERBOSE,
2222
)
2323

0 commit comments

Comments
 (0)