]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665) (GH-137774)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 Oct 2025 19:15:04 +0000 (21:15 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Oct 2025 19:15:04 +0000 (21:15 +0200)
commited904d5bbfa407771bf147c6eafd71f3b9a48869
tree463d73a2ae70de91796ccd054d0f7a82045671b5
parentf3d8338cd51012d8210d0582e683aec060e0de62
[3.9] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665) (GH-137774) (GH-139661)

"] ]>" and "]] >" no longer end the CDATA section.

Make CDATA section parsing  context depending.
Add private method HTMLParser._set_support_cdata() to change the context.
If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>".
If called with False, "<[CDATA[" starts a bogus comments which ends with ">".
(cherry picked from commit 0cbbfc462119b9107b373c24d2bda5a1271bed36)
(cherry picked from commit dcf24768c918c41821cda6fe6a1aa20ce26545dd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/html/parser.py
Lib/test/test_htmlparser.py
Misc/NEWS.d/next/Security/2025-06-18-13-34-55.gh-issue-135661.NZlpWf.rst [new file with mode: 0644]