-
-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
I do not understand the algorithm involved and I do not know how to reproduce this panic, but a panic happened once and it indicated that this was the source of that panic: Aabb::cast_local_ray_and_get_normal.
It looks obvious to me that this is the culprit:
let feature = if i < 0 {
FeatureId::Face((-i) as u32 - 1 + 3)
} else {
FeatureId::Face(i as u32 - 1)
};I do not know what guarantee is supposed to prevent i from being zero, but this panic suggests that sometimes somehow i can be zero. This value comes from clip_aabb_line and right here seems to be an example of that function returning a zero: clip_aabb_line.rs:150
Relevant details of the stack trace:
thread 'main' panicked at parry3d-0.24.0\src\query\ray\ray_aabb.rs:62:33:
attempt to subtract with overflow
parry3d::query::ray::ray_cuboid::impl$0::cast_local_ray_and_get_normal
at parry3d-0.24.0\src\query\ray\ray_cuboid.rs:23
parry3d::query::ray::ray::RayCast::cast_ray_and_get_normal<parry3d::shape::cuboid::Cuboid>
at parry3d-0.24.0\src\query\ray\ray.rs:175
rapier3d::pipeline::query_pipeline::impl$4::intersect_ray::closure$1
at rapier3d-0.29.0\src\pipeline\query_pipeline.rs:226
I would like to suggest a policy of using #![forbid(clippy::arithmetic_side_effects)] as a precaution against this sort of panic.
Metadata
Metadata
Assignees
Labels
No labels