You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alice-i-cecile opened this issue
Mar 30, 2022
· 2 comments
Labels
A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorP-HighThis is particularly urgent, and deserves immediate attention
the "safe" System::run doesn't validate world.
Obviously thats not good. But I'd prefer to solve the problem holistically / leave the current pattern in-tact. I think validating world at the System::run_unsafe level (and updating the _unchecked_manual safety docs) has my preference here, given that we are embracing the "just run a system" pattern.
This is blocking #4090, as otherwise the API exposed there will be similarly unsound.
Simple example (compiles on main, but not 0.6) demonstrating UB:
use bevy::prelude::*;structA;#[derive(Debug)]structB(i8);fnmain(){letmut world_1 = World::new();letmut world_2 = World::new();// Making sure that the memory layout of our worlds differ
world_1.insert_resource(A);
world_1.insert_resource(B(1));// Note that this test *succeeds* if the order is swapped
world_2.insert_resource(B(2));
world_2.insert_resource(A);letmut test_system = IntoSystem::into_system(hello_cursed_world);// Playing nice
test_system.initialize(&mut world_1);
test_system.run((),&mut world_1);// Oh no...// This should always panic, but instead crashes if the memory is wrong with// STATUS_ACCESS_VIOLATION
test_system.run((),&mut world_2);}fnhello_cursed_world(world:&World,b:Res<B>){let world_id = world.id();dbg!(b);println!("Hello, I'm running on {world_id:?}!");}
The text was updated successfully, but these errors were encountered:
alice-i-cecile
added
C-Bug
An unexpected or incorrect behavior
A-ECS
Entities, components, systems, and events
P-High
This is particularly urgent, and deserves immediate attention
labels
Mar 30, 2022
A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorP-HighThis is particularly urgent, and deserves immediate attention
This is blocking #4090, as otherwise the API exposed there will be similarly unsound.
Simple example (compiles on
main
, but not0.6
) demonstrating UB:The text was updated successfully, but these errors were encountered: