Skip to content

fix aliasing UB, layout UB, and incorrect initialization UB#939

Open
Morgane55440 wants to merge 1 commit into
dimforge:masterfrom
Morgane55440:master
Open

fix aliasing UB, layout UB, and incorrect initialization UB#939
Morgane55440 wants to merge 1 commit into
dimforge:masterfrom
Morgane55440:master

Conversation

@Morgane55440
Copy link
Copy Markdown

the get_disjoint_mut-likes are aliasing UB under the current memory model.
for more info, see the internal code of get_disjoint_mut and the relevant history.

as_vector on RigidBodyVelocity is UB because it is not #[repr(C)]

reset_buffer can cause incorrect initialization UB because it initializes len bytes, but it says it has initialized len * size_of:::<T> bytes.

the get_disjoint_mut-likes have been checked to result in the same assembly after fix :

the asm for reset_buffer is slightly different, but it still uses memset which is the important part.

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.

1 participant