-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Heap-use-after-free in move_and_slide if the floor body is freed #74732
Comments
Looks like the problem is the There doesn't appear to be any accounting for the possibility the body could be deleted in between Some thoughts on options to solve:
I'll have a think about best way to solve. |
Had a look in master today, it seems like the same vulnerability is present there too in Master does additionally store an So whichever method we go with will need to be applied there too, but will wait for discussion with @reduz before proceeding. |
Fixed by #88946. |
Godot version
3.5.1
System information
Arch Linux (rolling release), Bullet Physics
Issue description
While testing my project in address sanitizer I ran into this fatal error that seems to occur when my player character smashes into an object from above and destroys it:
Screencast.from.2023-03-10.16-24-25.mp4
I believe that this could cause a crash (but haven't seen it do that in practice yet).
The player character is a KinematicBody. The rock is a RigidBody with mode static. Upon contact with the rock, if the player has enough speed, the rock is destroyed (
queue_free
is called). Asan only reports the error if the rock is smashed from above like in the video, not if you slam into it from the side.I think that the KinematicBody's
on_floor_body
is left dangling when the rock's RID is freed. Then whenmove_and_slide
is called next time, it tries to get the direct state of the body with the freed RID.Calling
queue_free
on the rock a frame after removing it from the tree does not produce the error.Steps to reproduce
use_asan=yes
Minimal reproduction project
move_and_slide.zip
The text was updated successfully, but these errors were encountered: