Skip to content

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

@lwz23

Description

@lwz23

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions