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

Refactor unsafe code in raw_jobs.rs for better memory safety #212

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

SCingolani
Copy link
Contributor

A potential issue was present where the check to the pointed to memory was done independently to the cast to the Rust type. The check was meant to protect from casting memory in an invalid state, but did not protect from the memory being modified in between the check and the cast.

This new version creates a copy on the stack first. This way, we can safely validate it and trust our own memory to still be valid when we call assume_init().

A potential issue was present where the check to the pointed to memory
was done independently to the cast to the Rust type. The check was meant
to protect from casting memory in an invalid state, but did not protect
from the memory being modified in between the check and the cast.

This new version creates a copy on the stack _first_. This way, we can
safely validate it and trust our own memory to still be valid when we
call `assume_init()`.
@inorick inorick merged commit c4f143d into main Oct 25, 2024
29 checks passed
@inorick inorick deleted the saci/fix-from-raw branch October 25, 2024 07:13
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.

2 participants