Skip to content

gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224)#145987

Merged
picnixz merged 7 commits intopython:mainfrom
StanFromIreland:expat-crash
Mar 15, 2026
Merged

gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224)#145987
picnixz merged 7 commits intopython:mainfrom
StanFromIreland:expat-crash

Conversation

@StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Mar 15, 2026

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@StanFromIreland StanFromIreland requested a review from picnixz March 15, 2026 19:43
@picnixz picnixz changed the title gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) Mar 15, 2026
@picnixz picnixz merged commit eb0e8be into python:main Mar 15, 2026
55 checks passed
@miss-islington-app
Copy link

Thanks @StanFromIreland for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11, 3.12, 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 15, 2026
… `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 15, 2026
… `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-145995 is a backport of this pull request to the 3.14 branch.

@miss-islington-app
Copy link

Sorry, @StanFromIreland and @picnixz, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker eb0e8be3a7e11b87d198a2c3af1ed0eccf532768 3.12

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 15, 2026
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-145996 is a backport of this pull request to the 3.13 branch.

@miss-islington-app
Copy link

Sorry, @StanFromIreland and @picnixz, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker eb0e8be3a7e11b87d198a2c3af1ed0eccf532768 3.11

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 15, 2026
@miss-islington-app
Copy link

Sorry, @StanFromIreland and @picnixz, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker eb0e8be3a7e11b87d198a2c3af1ed0eccf532768 3.10

@StanFromIreland StanFromIreland deleted the expat-crash branch March 15, 2026 21:48
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Mar 15, 2026
…del` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Mar 15, 2026
…del` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-145999 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Mar 15, 2026
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Mar 15, 2026
…del` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)
(cherry picked from commit e5caf45)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-146000 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Mar 15, 2026
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Mar 15, 2026
…del` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)
(cherry picked from commit e5caf45)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-146002 is a backport of this pull request to the 3.10 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.10 only security fixes label Mar 15, 2026
picnixz added a commit that referenced this pull request Mar 15, 2026
…n `pyexpat.c` (CVE 2026-4224) (GH-145987) (#145995)

gh-145986: Avoid unbound C recursion in `conv_content_model` in `pyexpat.c` (CVE 2026-4224) (GH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
kumaraditya303 pushed a commit that referenced this pull request Mar 16, 2026
…n `pyexpat.c` (CVE 2026-4224) (GH-145987) (#145996)

* gh-145986: Avoid unbound C recursion in `conv_content_model` in `pyexpat.c` (CVE 2026-4224) (GH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Remvoe `skip_if_unlimited_stack_size` decorator

* Remove more decorators not on this branch

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants