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

Possible unsound problems in crates/starlight/src/vm/environment.rs #137

Open
lwz23 opened this issue Dec 2, 2024 · 0 comments
Open

Possible unsound problems in crates/starlight/src/vm/environment.rs #137

lwz23 opened this issue Dec 2, 2024 · 0 comments

Comments

@lwz23
Copy link

lwz23 commented Dec 2, 2024

Although the library may no longer be maintained and will not compile in my current environment, I intend to report the issue for reference only.
Description

pub fn as_slice(&self) -> &[Variable] {

pub fn as_slice_mut(&mut self) -> &mut [Variable] {

consider the two functions above, they use unsafe API from_raw_parts and from_raw_parts_mut, however, the Environment is a pub struct which means the user can directly manipulate its values_ptr and values_count fields, which are also pub, and pass directly into the unsafe API, so I believe there is a health issue here.

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