bevy/crates
Nathan Ward cbfb456847 [bevy_core/bytes] Fix UB with accessing memory with incorrect alignment (#1966)
After running `bevy_core` through `miri`, errors were reported surrounding incorrect memory accesses within the `bytes` test suit. 

Specifically:
```
test bytes::tests::test_array_round_trip ... error: Undefined Behavior: accessing memory with alignment 1, but alignment 4 is required
   --> crates/bevy_core/src/bytes.rs:55:13
    |
55  |             (*ptr).clone()
    |             ^^^^^^ accessing memory with alignment 1, but alignment 4 is required
    |
```

and 

```
test bytes::tests::test_vec_bytes_round_trip ... error: Undefined Behavior: accessing memory with alignment 2, but alignment 4 is required
   --> /home/nward/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/raw.rs:95:14
    |
95  |     unsafe { &*ptr::slice_from_raw_parts(data, len) }
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 2, but alignment 4 is required
    |
```

Solution:

The solution is to use `slice::align_to` method to ensure correct alignment.
2021-04-20 21:04:08 +00:00
..
bevy_app run some examples on CI using swiftshader (#1826) 2021-04-14 21:40:36 +00:00
bevy_asset Document setting "CARGO_MANIFEST_DIR" for asset root (#1950) 2021-04-19 22:16:23 +00:00
bevy_audio Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_core [bevy_core/bytes] Fix UB with accessing memory with incorrect alignment (#1966) 2021-04-20 21:04:08 +00:00
bevy_derive Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_diagnostic Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_dylib Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_dynamic_plugin Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_ecs Added missing Component Bound to Res<> and ResMut<> (#1962) 2021-04-19 21:53:34 +00:00
bevy_gilrs Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_gltf calculate flat normals for mesh if missing (#1808) 2021-04-15 21:06:49 +00:00
bevy_input Moved events to ECS (#1823) 2021-04-13 20:36:37 +00:00
bevy_internal run some examples on CI using swiftshader (#1826) 2021-04-14 21:40:36 +00:00
bevy_log Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_math Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_pbr fix memory size for PointLightBundle (#1940) 2021-04-19 19:30:39 +00:00
bevy_reflect Override size_hint for all Iterators and add ExactSizeIterator where applicable (#1734) 2021-04-13 01:28:14 +00:00
bevy_render Added TryFrom for VertexAttributeValues (#1963) 2021-04-20 20:41:32 +00:00
bevy_scene Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_sprite Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_tasks Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_text Update old docs mentioning Camera2dBundle (#1836) 2021-04-06 21:05:08 +00:00
bevy_transform Add synonyms for transform relative vectors (#1667) 2021-04-12 21:53:05 +00:00
bevy_ui Label for ui_focus_system (#1926) 2021-04-19 19:15:27 +00:00
bevy_utils Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_wgpu Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_window Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00
bevy_winit Release 0.5.0 (#1835) 2021-04-06 18:48:48 +00:00