-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-42400: Fix buffer overflow in _Py_wrealpath for long paths #141529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ashm-dev
wants to merge
8
commits into
python:main
Choose a base branch
from
ashm-dev:fix/cve-realpath
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7
−3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1424245 to
3255a3d
Compare
52f60a5 to
bb4af8a
Compare
Allow platforms where realpath returns different canonical paths (e.g. Android). Verify resolution with os.samefile and fall back to a length check if samefile is unavailable.
Contributor
Author
|
I don't think the errors in the UBSAN test are related to this fix, as they occur for a completely different reason and generally in import tests. |
Contributor
Author
|
@vstinner Could you please review this PR? |
vstinner
reviewed
Nov 14, 2025
Misc/NEWS.d/next/Security/2025-11-13-22-31-56.gh-issue-42400.pqB5Kq.rst
Outdated
Show resolved
Hide resolved
…qB5Kq.rst Co-authored-by: Victor Stinner <vstinner@python.org>
Member
|
I updated the PR to retrieve the fix for the UBSan CI. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes buffer overflow (CVE-2006-1542) in
_Py_wrealpath()when handling paths longer than MAXPATHLEN (4096 bytes).Changed
realpath(path, buffer)torealpath(path, NULL)for dynamic allocation.Closes #42400
realpath#42400