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-134070: Prevent out-of-bounds read in mi_clz32 and mi_ctz32#134149

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vedant713 wants to merge6 commits intopython:main
base:main
Choose a base branch
Loading
fromvedant713:fix-mimalloc-bug

Conversation

vedant713
Copy link

FixesGH-134070

Summary:
This patch adds a masking operation to the index calculation inmi_ctz32() andmi_clz32() functions to prevent out-of-bounds access on 64-bit systems, matching the fix from upstream mimalloc.

Why:
On systems whereunsigned long is 64-bit, the multiplication may produce a value >31, causing a read outside the array bounds.

@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.

@ZeroIntensityZeroIntensity changed the titleFix: Prevent out-of-bounds read in mi_clz32 and mi_ctz32 (#134070)gh-134070: Prevent out-of-bounds read in mi_clz32 and mi_ctz32 (#134070)May 17, 2025
@ZeroIntensityZeroIntensity added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 17, 2025
@ZeroIntensityZeroIntensity changed the titlegh-134070: Prevent out-of-bounds read in mi_clz32 and mi_ctz32 (#134070)gh-134070: Prevent out-of-bounds read in mi_clz32 and mi_ctz32May 17, 2025
Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

Please add a test and blurb.

@collinfunk
Copy link
Contributor

FYI, this code is fromhttps://github.com/microsoft/mimalloc. You might want to send a pull request there too.

@picnixz
Copy link
Member

It's said to be fixed inmicrosoft/mimalloc@ed31847.

@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.

@picnixz
Copy link
Member

Please, stop updating two PRs at the same time. Seehttps://devguide.python.org/getting-started/pull-request-lifecycle/. I am going to close the other PR as it only contains the NEWS entry. In addition, please do not merge main into this branch if there is no conflict. TiA.

vedant713 reacted with thumbs up emoji

@vedant713
Copy link
Author

I'm trying to add via heroku app but giving server error
bedevere/news
bedevere/news — No news entry in Misc/NEWS.d/next/ or "skip news" label found

@picnixz
Copy link
Member

picnixz commentedMay 17, 2025
edited
Loading

I never used the app, so I'd suggest using the command-line instead:

python -m pip install blurbpython -m blurbgit commit -m 'blurb'

@picnixzpicnixz marked this pull request as draftMay 17, 2025 20:33
@vedant713vedant713 marked this pull request as ready for reviewMay 17, 2025 21:52
@collinfunk
Copy link
Contributor

@picnixz Thanks for checking. Somehow I missed that commit in mimalloc.

@colesbury
Copy link
Contributor

I think we should copy-paste the change from upstream instead of doing a similar (but not identical) fix here.

In other words, copy this code from upstream (from the fix commit) into ourmimalloc/internal.h file.

https://github.com/microsoft/mimalloc/blob/ed318471126918fce7caf0001cf1e0c78f95173e/include/mimalloc/internal.h#L875-L932

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

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@colesburycolesburyAwaiting requested review from colesbury

Assignees
No one assigned
Labels
awaiting reviewneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixes
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Out-of-bounds read in integrated mimalloc (fixed upstream)
5 participants
@vedant713@collinfunk@picnixz@colesbury@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp