Skip to content

Comments

fix: replace unsafe zeroed() with MaybeUninit in split_at#1237

Open
crStiv wants to merge 2 commits intostarkware-libs:devfrom
crStiv:fix/safe-array-initialization
Open

fix: replace unsafe zeroed() with MaybeUninit in split_at#1237
crStiv wants to merge 2 commits intostarkware-libs:devfrom
crStiv:fix/safe-array-initialization

Conversation

@crStiv
Copy link

@crStiv crStiv commented Nov 7, 2025

Replace std::mem::zeroed() with MaybeUninit for safe array initialization in ArrayOfVecs split_at method.
References don't have a zero representation, so zeroed() was creating invalid values leading to potential UB.

The fix uses MaybeUninit arrays that are safely initialized element by element before being converted to initialized arrays via array_assume_init().
Also removed the #[allow(invalid_value)] attribute that's no longer needed.

@reviewable-StarkWare
Copy link

This change is Reviewable

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