Skip to content

gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 - #115164

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:test-etree-xmlpullparser-expat-2.6.0
Feb 11, 2024
Merged

gh-115133: Fix tests for XMLPullParser with Expat 2.6.0#115164
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:test-etree-xmlpullparser-expat-2.6.0

Conversation

@serhiy-storchaka

@serhiy-storchakaserhiy-storchaka commented Feb 8, 2024

Copy link
Copy Markdown
Member

Feeding the parser by too small chunks defers parsing to prevent CVE-2023-52425. Future versions of Expat may be more reactive.

Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
@lazka

lazka commented Feb 10, 2024

Copy link
Copy Markdown
Contributor

It stills fails here with this patch applied:

FAIL: test_simple_xml_chunk_8 (test.test_xml_etree.XMLPullParserTest.test_simple_xml_chunk_8)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\cpython-mingw\cpython-mingw\Lib\test\test_xml_etree.py", line 1438, in test_simple_xml_chunk_8
self.test_simple_xml(chunk_size=8)
File "D:\a\cpython-mingw\cpython-mingw\Lib\test\test_xml_etree.py", line 1418, in test_simple_xml
self.assert_event_tags(parser, [('end', 'element')])
File "D:\a\cpython-mingw\cpython-mingw\Lib\test\test_xml_etree.py", line 1405, in assert_event_tags
self.assertEqual([(action, elem.tag) for action, elem in events],
AssertionError: Lists differ: [] != [('end', 'element')]
Second list contains 1 additional elements.
First extra element 0:
('end', 'element')
- []
+ [('end', 'element')]
> python3 -c "import pyexpat; print(pyexpat.version_info)"
(2, 6, 0)

@serhiy-storchaka

Copy link
Copy Markdown
MemberAuthor

What is the smallest value of chunk_size with which the test would pass?

@lazka

lazka commented Feb 10, 2024

Copy link
Copy Markdown
Contributor

chunk_size=22 is the smallest value that works on my machine.

Comment threadLib/test/test_xml_etree.py Outdated
@serhiy-storchaka

Copy link
Copy Markdown
MemberAuthor

Thank you for testing @lazka.

@serhiy-storchaka
serhiy-storchaka merged commit 4a08e7b into python:mainFeb 11, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@serhiy-storchaka
serhiy-storchaka deleted the test-etree-xmlpullparser-expat-2.6.0 branch February 11, 2024 10:08
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 11, 2024
…GH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.12 only security fixes label Feb 11, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 11, 2024
…GH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.11 only security fixes label Feb 11, 2024
serhiy-storchaka added a commit that referenced this pull request Feb 11, 2024
…5164) (GH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Feb 11, 2024
…5164) (GH-115289)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@hartworkhartwork mentioned this pull request Feb 12, 2024
13 tasks
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
…GH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
@hartworkhartwork mentioned this pull request Feb 14, 2024
28 tasks
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 4a08e7b3431cd32a0daf22a33421cd3035343dc4 3.8

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 4a08e7b3431cd32a0daf22a33421cd3035343dc4 3.9

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 15, 2024
…GH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.10 only security fixes label Feb 15, 2024
sethmlarson pushed a commit to sethmlarson/cpython that referenced this pull request Feb 15, 2024
…ythonGH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
sethmlarson pushed a commit to sethmlarson/cpython that referenced this pull request Feb 15, 2024
…ythonGH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@sethmlarson

Copy link
Copy Markdown
Contributor

Created backports for 3.9 and 3.8 manually:

pablogsal pushed a commit that referenced this pull request Feb 19, 2024
…5164) (#115525)
gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Feb 19, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Feb 19, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Feb 19, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv pushed a commit that referenced this pull request Feb 21, 2024
) (GH-115536)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Feb 21, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Jul 11, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Jul 11, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to naveen521kk/cpython that referenced this pull request Jul 11, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
naveen521kk pushed a commit to msys2-contrib/cpython-mingw that referenced this pull request Aug 5, 2024
…ythonGH-115164) (pythonGH-115288)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchakaserhiy-storchaka removed their assignment Jul 15, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@serhiy-storchaka@lazka@sethmlarson@hartwork@Snild-Sony@hugovk