mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #8175: intersphinx: Potential of regex denial of service by inventory
This commit is contained in:
parent
a81c45367a
commit
f7b872e673
1
CHANGES
1
CHANGES
@ -35,6 +35,7 @@ Bugs fixed
|
|||||||
* #8192: napoleon: description is disappeared when it contains inline literals
|
* #8192: napoleon: description is disappeared when it contains inline literals
|
||||||
* #8172: napoleon: Potential of regex denial of service in google style docs
|
* #8172: napoleon: Potential of regex denial of service in google style docs
|
||||||
* #8169: LaTeX: pxjahyper loaded even when latex_engine is not platex
|
* #8169: LaTeX: pxjahyper loaded even when latex_engine is not platex
|
||||||
|
* #8175: intersphinx: Potential of regex denial of service by broken inventory
|
||||||
* #8093: The highlight warning has wrong location in some builders (LaTeX,
|
* #8093: The highlight warning has wrong location in some builders (LaTeX,
|
||||||
singlehtml and so on)
|
singlehtml and so on)
|
||||||
|
|
||||||
|
@ -122,11 +122,16 @@ class InventoryFile:
|
|||||||
|
|
||||||
for line in stream.read_compressed_lines():
|
for line in stream.read_compressed_lines():
|
||||||
# be careful to handle names with embedded spaces correctly
|
# be careful to handle names with embedded spaces correctly
|
||||||
m = re.match(r'(?x)(.+?)\s+(\S*:\S*)\s+(-?\d+)\s+?(\S*)\s+(.*)',
|
m = re.match(r'(?x)(.+?)\s+(\S+)\s+(-?\d+)\s+?(\S*)\s+(.*)',
|
||||||
line.rstrip())
|
line.rstrip())
|
||||||
if not m:
|
if not m:
|
||||||
continue
|
continue
|
||||||
name, type, prio, location, dispname = m.groups()
|
name, type, prio, location, dispname = m.groups()
|
||||||
|
if ':' not in type:
|
||||||
|
# wrong type value. type should be in the form of "{domain}:{objtype}"
|
||||||
|
#
|
||||||
|
# Note: To avoid the regex DoS, this is implemented in python (refs: #8175)
|
||||||
|
continue
|
||||||
if type == 'py:module' and type in invdata and name in invdata[type]:
|
if type == 'py:module' and type in invdata and name in invdata[type]:
|
||||||
# due to a bug in 1.1 and below,
|
# due to a bug in 1.1 and below,
|
||||||
# two inventory entries are created
|
# two inventory entries are created
|
||||||
|
Loading…
Reference in New Issue
Block a user