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

Calling set on VariantArray with an out of bounds index causes segfault #790

Closed
jacobsky opened this issue Oct 1, 2021 · 0 comments · Fixed by #795
Closed

Calling set on VariantArray with an out of bounds index causes segfault #790

jacobsky opened this issue Oct 1, 2021 · 0 comments · Fixed by #795
Labels
bug c: core Component: core (mod core_types, object, log, init, ...)
Milestone

Comments

@jacobsky
Copy link
Contributor

jacobsky commented Oct 1, 2021

As mentioned in discord

let vertices : Vec<Vector3> = vec![];
let arrays = VariantArray::new();
arrays.set(ArrayMesh::ARRAY_VERTEX as i32, vertices);

The issue is that VariantArray::set is not an unsafe function.

This should be corrected either by making the function unsafe, or doing some internal bounds checking to be inline with the Rust guidelines.

As a follow-up we should review the VariantArray/Dictionary APIs to ensure there's no other unexpected UB

@jacobsky jacobsky added bug c: core Component: core (mod core_types, object, log, init, ...) labels Oct 1, 2021
@jacobsky jacobsky added this to the v0.10 milestone Oct 1, 2021
bors bot added a commit that referenced this issue Nov 1, 2021
795: Remove or change APIs causing UB r=Bromeon a=Bromeon

Fixes #790 

Changes in commit message

Co-authored-by: Jan Haller <[email protected]>
@bors bors bot closed this as completed in 8c5cda8 Nov 1, 2021
@Bromeon Bromeon mentioned this issue Jan 9, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug c: core Component: core (mod core_types, object, log, init, ...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant