Skip to content
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

Add WriteableProcessBuffer::mut_ptr #3756

Open
kupiakos opened this issue Dec 9, 2023 · 1 comment
Open

Add WriteableProcessBuffer::mut_ptr #3756

kupiakos opened this issue Dec 9, 2023 · 1 comment

Comments

@kupiakos
Copy link
Contributor

kupiakos commented Dec 9, 2023

<ReadWriteProcessBuffer as ReadableProcessBuffer>::ptr returns *const u8 and, due to its implementation, it's valid to .cast_mut() that and then (in a single thread) write to it so long as it's not empty (and null). A WriteableProcessBuffer::mut_ptr function would be much less risky against implementation change and rely on more explicit promises.

@kupiakos
Copy link
Contributor Author

An alternative that would not be a breaking change: document explicitly that for any impl WriteableProcessBuffer, the return value of <ReadWriteProcessBuffer as ReadableProcessBuffer>::ptr must be a writeable pointer. This should be indicated in the unsafe trait requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant