]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH...
authorSebastian Pipping <sebastian@pipping.org>
Wed, 6 Mar 2024 22:17:02 +0000 (23:17 +0100)
committerGitHub <noreply@github.com>
Wed, 6 Mar 2024 22:17:02 +0000 (14:17 -0800)
commitfc9da9627437acdb15ff9b1c08bcece108896a9a
treed9386a2a129475f0f12a4c2229abd85f79a79dd0
parente8fb762fa9bcca25a857fc416221ca752ad09f42
[3.11] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (#116268)

Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from #115138 (comment) .

- Please treat as a security fix related to CVE-2023-52425.

(cherry picked from commit 6a95676)
(cherry picked from commit 73807eb)
(cherry picked from commit eda2963)

---------

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
14 files changed:
Doc/library/pyexpat.rst
Doc/library/xml.etree.elementtree.rst
Include/pyexpat.h
Lib/test/test_pyexpat.py
Lib/test/test_sax.py
Lib/test/test_xml_etree.py
Lib/xml/etree/ElementTree.py
Lib/xml/sax/expatreader.py
Misc/NEWS.d/next/Security/2024-02-18-03-14-40.gh-issue-115398.tzvxH8.rst [new file with mode: 0644]
Modules/_elementtree.c
Modules/clinic/_elementtree.c.h
Modules/clinic/pyexpat.c.h
Modules/expat/pyexpatns.h
Modules/pyexpat.c