FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159739: Handle overlapping mmap writes by jelle-openai · Pull Request #160189 · python/cpython · GitHub

Repository navigation

gh-159739: Handle overlapping mmap writes - #160189

Open
jelle-openai wants to merge 2 commits into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-mmap-overlap
Open

jelle-openai wants to merge 2 commits into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-mmap-overlap

Conversation

jelle-openai commented Oct 22, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Writing a memoryview of an mmap back into an overlapping region, through write() or contiguous slice assignment, used memcpy(), which has undefined behavior for overlapping ranges and can corrupt the mapped data. Use overlap-safe copying for both operations. Backport to 3.15 and 3.14.

Writing a memoryview of an mmap back into an overlapping region, through write() or contiguous slice assignment, used memcpy(), which has undefined behavior for overlapping ranges and can corrupt the mapped data. Use overlap-safe copying for both operations. Backport to 3.15 and 3.14.
Comment thread Modules/mmapmodule.c
if (safe_copy_from_slice(self->data, (char *)vbuf.buf, start, step,
slicelen) < 0)
{
/* The source may overlap the destination, so copy it before

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Feels like this can hurt performance, let's look for a better solution.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL