Repository navigation
Conversation
Copying a mapping copied the file descriptor and the address range (or the Windows handles), so both copies unmapped the same range on destruction: a double munmap with a use-after-free for whoever read through the surviving copy. Copies are now deleted and a move transfers ownership, leaving the moved-from object owning nothing (destructor no-op). Move assignment releases the previous mapping first. Co-Authored-By: OpenCode <noreply@opencode.ai>
Owner
Author
|
Pushed directly to main instead. |
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
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.
memory_mapped_filehad no move constructor but kept the implicit copy constructor.A copy or a move left two objects owning the same mapping, and both unmapped it on destruction (the survivor then read freed memory).
CDFpp was safe only because it always holds the mapping through a
shared_ptr. CEFast hit it when storing the mapping in astd::variant.Tests: compile-time traits (not copyable, movable) and two runtime cases (move then destroy the source first; move-assign over an existing mapping). Red before the fix, 38/38 after.
🤖 Generated with Claude Code