parry icon indicating copy to clipboard operation
parry copied to clipboard

Convex decomposition can panic

Open ThierryBerger opened this issue 6 months ago • 0 comments

A path to panic can be reached through convex decomposition, which is used in a fair number of api calls.

  • https://github.com/dimforge/parry/issues/65#issuecomment-2626499350
  • https://github.com/Jondolf/avian/issues/645
Details

   0: __rustc::rust_begin_unwind
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:75:14
   2: core::result::unwrap_failed
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/result.rs:1704:5
   3: unwrap<(alloc::vec::Vec<nalgebra::geometry::point::OPoint<f32, nalgebra::base::dimension::Const<3>>, alloc::alloc::Global>, alloc::vec::Vec<[u32; 3], alloc::alloc::Global>), parry3d::transformation::convex_hull3::error::ConvexHullError>
             at /home/tb/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1109:23
   4: convex_hull
             at ./../../src/transformation/convex_hull3/convex_hull.rs:12:5
   5: parry3d::transformation::voxelization::voxel_set::convex_hull
             at ./../../src/transformation/voxelization/voxel_set.rs:688:9
   6: parry3d::transformation::voxelization::voxel_set::VoxelSet::compute_convex_hull
             at ./../../src/transformation/voxelization/voxel_set.rs:431:9
   7: parry3d::transformation::vhacd::vhacd::VHACD::process_primitive_set
             at ./../../src/transformation/vhacd/vhacd.rs:286:34
   8: parry3d::transformation::vhacd::vhacd::VHACD::do_compute_acd
             at ./../../src/transformation/vhacd/vhacd.rs:400:17
   9: parry3d::transformation::vhacd::vhacd::VHACD::from_voxels
             at ./../../src/transformation/vhacd/vhacd.rs:97:9
  10: parry3d::transformation::vhacd::vhacd::VHACD::decompose
             at ./../../src/transformation/vhacd/vhacd.rs:78:26
  11: parry3d::shape::shared_shape::SharedShape::convex_decomposition_with_params
             at ./../../src/shape/shared_shape.rs:324:22
  12: convex_decomp_resolution
             at ./../../src/shape/shared_shape.rs:544:22
  13: parry3d::shape::shared_shape::test::convex_decomp_resolution::{{closure}}
             at ./../../src/shape/shared_shape.rs:527:34
  14: core::ops::function::FnOnce::call_once
             at /home/tb/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  15: core::ops::function::FnOnce::call_once
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ops/function.rs:250:5

A path to resolution could be to use try_convex_hull and bubble the error up wherever possible.

ThierryBerger avatar Jun 19 '25 08:06 ThierryBerger