2025-07-02 16:13:50 +00:00
committed by Git OBS Bridge
parent 420a5bd2d2
commit 1bf3058aba

View File

@@ -10,16 +10,16 @@ comments and declarations are automatically closed, tags are ignored.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
--- ---
Lib/html/parser.py | 41 ++++++-- Lib/html/parser.py | 41 +++++---
Lib/test/test_htmlparser.py | 49 +++++++--- Lib/test/test_htmlparser.py | 51 +++++++---
Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst | 4 Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst | 4
3 files changed, 73 insertions(+), 21 deletions(-) 3 files changed, 74 insertions(+), 22 deletions(-)
create mode 100644 Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst create mode 100644 Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst
Index: Python-3.11.13/Lib/html/parser.py Index: Python-3.11.13/Lib/html/parser.py
=================================================================== ===================================================================
--- Python-3.11.13.orig/Lib/html/parser.py 2025-07-02 17:11:09.096534277 +0200 --- Python-3.11.13.orig/Lib/html/parser.py 2025-07-02 18:12:07.084569398 +0200
+++ Python-3.11.13/Lib/html/parser.py 2025-07-02 17:11:16.977433541 +0200 +++ Python-3.11.13/Lib/html/parser.py 2025-07-02 18:12:12.582519793 +0200
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]') charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
@@ -85,8 +85,8 @@ Index: Python-3.11.13/Lib/html/parser.py
match = charref.match(rawdata, i) match = charref.match(rawdata, i)
Index: Python-3.11.13/Lib/test/test_htmlparser.py Index: Python-3.11.13/Lib/test/test_htmlparser.py
=================================================================== ===================================================================
--- Python-3.11.13.orig/Lib/test/test_htmlparser.py 2025-07-02 17:11:10.487699349 +0200 --- Python-3.11.13.orig/Lib/test/test_htmlparser.py 2025-07-02 18:12:08.523658593 +0200
+++ Python-3.11.13/Lib/test/test_htmlparser.py 2025-07-02 17:12:43.419502465 +0200 +++ Python-3.11.13/Lib/test/test_htmlparser.py 2025-07-02 18:13:32.674943007 +0200
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
import pprint import pprint
import unittest import unittest
@@ -141,14 +141,17 @@ Index: Python-3.11.13/Lib/test/test_htmlparser.py
def test_slashes_in_starttag(self): def test_slashes_in_starttag(self):
self._run_check('<a foo="var"/>', [('startendtag', 'a', [('foo', 'var')])]) self._run_check('<a foo="var"/>', [('startendtag', 'a', [('foo', 'var')])])
@@ -544,6 +552,7 @@ @@ -549,8 +557,9 @@
'<!><!<-- this was an empty comment>'
'<!!! another bogus comment !!!>')
expected = [
+ ('comment', 'ELEMENT br EMPTY'),
('comment', ' not really a comment '),
('comment', ' not a comment either --'),
('comment', ' -- close enough --'), ('comment', ' -- close enough --'),
('comment', ''),
('comment', '<-- this was an empty comment'),
- ('comment', '!! another bogus comment !!!'),
+ ('comment', '!! another bogus comment !!!')
]
+
self._run_check(html, expected)
def test_broken_condcoms(self):
@@ -598,6 +607,26 @@ @@ -598,6 +607,26 @@
('endtag', 'a'), ('data', ' bar & baz')] ('endtag', 'a'), ('data', ' bar & baz')]
) )
@@ -179,7 +182,7 @@ Index: Python-3.11.13/Lib/test/test_htmlparser.py
Index: Python-3.11.13/Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst Index: Python-3.11.13/Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ Python-3.11.13/Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst 2025-07-02 17:11:16.978605629 +0200 +++ Python-3.11.13/Misc/NEWS.d/next/Security/2025-06-13-15-55-22.gh-issue-135462.KBeJpc.rst 2025-07-02 18:12:12.583386736 +0200
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+Fix quadratic complexity in processing specially crafted input in +Fix quadratic complexity in processing specially crafted input in
+:class:`html.parser.HTMLParser`. End-of-file errors are now handled according +:class:`html.parser.HTMLParser`. End-of-file errors are now handled according