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

fix: Use unaligned read as copy_nonoverlapping requires alignment #1278

Merged
merged 3 commits into from
Jul 11, 2023

Conversation

mmastrac
Copy link
Contributor

@mmastrac mmastrac commented Jul 11, 2023

copy_nonoverlapping is not valid to use here as:

Behavior is undefined if any of the following conditions are violated:

src must be [valid](https://doc.rust-lang.org/stable/std/ptr/index.html#safety) for reads of count * size_of::<T>() bytes.
dst must be [valid](https://doc.rust-lang.org/stable/std/ptr/index.html#safety) for writes of count * size_of::<T>() bytes.
Both src and dst must be properly aligned.

The region of memory beginning at src with a size of count * size_of::<T>() bytes must not overlap with the region of memory beginning at dst with the same size.

@mmastrac mmastrac merged commit 226c662 into denoland:main Jul 11, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants