From: Serhiy Storchaka Date: Sun, 17 Aug 2025 10:37:50 +0000 (+0300) Subject: gh-135661: Fix parsing unterminated bogus comments in HTMLParser (GH-137873) X-Git-Tag: v3.15.0a1~666 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7636a66635a0da849cfccd06a52d0a21fb692271;p=thirdparty%2FPython%2Fcpython.git gh-135661: Fix parsing unterminated bogus comments in HTMLParser (GH-137873) Bogus comments that start with "', i+9) - if j < 0: - return -1 - self.unknown_decl(rawdata[i+3: j]) - return j + 3 - else: - return self.parse_bogus_comment(i) + elif rawdata[i:i+9] == '', i+9) + if j < 0: + return -1 + self.unknown_decl(rawdata[i+3: j]) + return j + 3 elif rawdata[i:i+9].lower() == ' gtpos = rawdata.find('>', i+9) diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index fff41dab321a..6a1d69335a06 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -791,7 +791,7 @@ text self._run_check('