Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-144872: fix heap buffer overflow_PyTokenizer_ensure_utf8#144807

Merged
pablogsal merged 6 commits intopython:mainfrom
AdamKorcz:oss-fuzz-fix-1
Feb 26, 2026
Merged

gh-144872: fix heap buffer overflow_PyTokenizer_ensure_utf8#144807
pablogsal merged 6 commits intopython:mainfrom
AdamKorcz:oss-fuzz-fix-1

Conversation

@AdamKorcz
Copy link
Contributor

@AdamKorczAdamKorcz commentedFeb 13, 2026
edited by bedevere-appbot
Loading

Signed-off-by: Adam <adam@Adam-Workstation.lan>
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

standaell1234-maker

This comment was marked as spam.

@ammaraskar
Copy link
Member

Thanks for the contribution! Would you mind adding a regression test for this inhttps://github.com/python/cpython/blob/main/Lib/test/test_tokenize.py

@gpsheadgpshead self-assigned thisFeb 14, 2026
Add a test covering truncated multi-byte UTF-8 sequences at end of input.Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@gpshead
Copy link
Member

I added a test.

(discussed with PSRT) We're not considering this a security issue,compile() is not safe against untrusted input (nor are the other paths that are actually executing code rather than just compiling it). It can read a couple bytes past the end of the input bytes at most. at worst a crash (ASAN in particular which I believe is how oss-fuzz found it), you'd likely get a SyntaxError as intended otherwise.

AdamKorcz reacted with thumbs up emoji

@gpshead
Copy link
Member

We do like to have issues filed to track things - read up onhttps://devguide.python.org/getting-started/pull-request-lifecycle/#pullrequest
As I believe you're intending to fix up a bunch of fuzzer found items, consider making a tracking issue for similar themes of those "parser crashes" or similar for this one for example - we don't need one issue per item when they aren't actually security related.

while you're working on already public oss-fuzz findings, as they are public it is fine to go ahead and make public PRs.

But if you come across any that seem actually security relevant, please reach out via email to the to PSRT, or since you're producing fix PRs maybe just usehttps://github.com/python/cpython/security to drop those in GHSA's for us to look over (many will probably be things we just open directly to the public as a non-concern "more of a bug" like this one)

@AdamKorczAdamKorcz changed the titleoss-fuzz-451112368: fix found crashgh-144872: fix found crashFeb 16, 2026
Signed-off-by: Adam Korczynski <adam@adalogics.com>
@python-cla-bot
Copy link

python-cla-botbot commentedFeb 16, 2026
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@AdamKorczAdamKorcz changed the titlegh-144872: fix found crashgh-144872: fix heap buffer overflowFeb 16, 2026
AdamKorczand others added2 commitsFebruary 16, 2026 15:38
…9_Q30.rstCo-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
@AdamKorcz
Copy link
ContributorAuthor

@aisk thank you, is it me or you who needs to sign the CLA?

@AdamKorcz
Copy link
ContributorAuthor

@aisk thank you, is it me or you who needs to sign the CLA?

it was me.

@StanFromIrelandStanFromIreland changed the titlegh-144872: fix heap buffer overflowgh-144872: fix heap buffer overflow_PyTokenizer_ensure_utf8Feb 18, 2026
Copy link
Member

@pablogsalpablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

I moved the news entry to Core. THanks a lot for the great work@AdamKorcz 🚀

@pablogsalpablogsal added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsFeb 26, 2026
@pablogsalpablogsal merged commit3fc945d intopython:mainFeb 26, 2026
55 checks passed
@miss-islington-app
Copy link

Thanks@AdamKorcz for the PR, and@pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestFeb 26, 2026
…ythonGH-144807)(cherry picked from commit3fc945d)Co-authored-by: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com>
@miss-islington-app
Copy link

Sorry,@AdamKorcz and@pablogsal, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker 3fc945df22a169e039c3f21b44c0d08390a00c0c 3.13

@bedevere-app
Copy link

GH-145287 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelFeb 26, 2026
pablogsal pushed a commit that referenced this pull requestFeb 26, 2026
…GH-144807) (#145287)Co-authored-by: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com>
@pablogsal
Copy link
Member

@AdamKorcz can you do the 3.13 backport following#144807 (comment) ?

StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull requestMar 2, 2026
…_utf8` (pythonGH-144807)(cherry picked from commit3fc945d)Co-authored-by: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com>
@bedevere-app
Copy link

GH-145441 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMar 2, 2026
pablogsal pushed a commit that referenced this pull requestMar 2, 2026
…GH-144807) (#145441)(cherry picked from commit3fc945d)Co-authored-by: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotARM64 MacOS M1 NoGIL 3.13 (tier-2) has failed when building commit5577bd1.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1408/builds/1843) and take a look at the build logs.
  4. Check if the failure is related to this commit (5577bd1) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1408/builds/1843

Failed tests:

  • test_httpservers
  • test.test_concurrent_futures.test_thread_pool

Failed subtests:

  • test_free_reference - test.test_concurrent_futures.test_thread_pool.ThreadPoolExecutorTest.test_free_reference
  • test_large_content_length_truncated - test.test_httpservers.CGIHTTPServerTestCase.test_large_content_length_truncated

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_concurrent_futures/executor.py", line147, intest_free_referencefor _in support.sleeping_retry(support.SHORT_TIMEOUT):~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/support/__init__.py", line2596, insleeping_retryfor _in busy_retry(timeout, err_msg,error=error):~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/support/__init__.py", line2566, inbusy_retryraiseAssertionError(msg)AssertionError:timeout (45.9 seconds)Traceback (most recent call last):  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_concurrent_futures/executor.py", line147, intest_free_referencefor _in support.sleeping_retry(support.SHORT_TIMEOUT):~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/support/__init__.py", line2596, insleeping_retryfor _in busy_retry(timeout, err_msg,error=error):~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/support/__init__.py", line2566, inbusy_retryraiseAssertionError(msg)AssertionError:timeout (45.8 seconds)Traceback (most recent call last):  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_httpservers.py", line1028, intest_large_content_length_truncated    res=self.request('/cgi-bin/file1.py','POST',b'x', headers)  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_httpservers.py", line89, inrequestreturnself.connection.getresponse()~~~~~~~~~~~~~~~~~~~~~~~~~~~^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/http/client.py", line1450, ingetresponse    response.begin()~~~~~~~~~~~~~~^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/http/client.py", line336, inbegin    version, status, reason=self._read_status()~~~~~~~~~~~~~~~~~^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/http/client.py", line297, in_read_status    line=str(self.fp.readline(_MAXLINE+1),"iso-8859-1")~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^  File"/Users/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/socket.py", line719, inreadintoreturnself._sock.recv_into(b)~~~~~~~~~~~~~~~~~~~~^^^ConnectionResetError:[Errno 54] Connection reset by peer

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@aiskaiskaisk left review comments

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@pablogsalpablogsalpablogsal approved these changes

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

+1 more reviewer

@standaell1234-makerstandaell1234-makerstandaell1234-maker left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@pablogsalpablogsal

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8 participants

@AdamKorcz@ammaraskar@gpshead@pablogsal@bedevere-bot@aisk@StanFromIreland@standaell1234-maker

[8]ページ先頭

©2009-2026 Movatter.jp