Open szobov opened 3 years ago
Hi there, Another segfault with convex decomposition. This time here. Here is the mesh to reproduce. broken_mesh1621252191.stl.zip
Traceback from LLDB:
Process 239893 launched: 'test_exe' (x86_64)
Process 239893 stopped
* thread #1, name = 'test_exe', stop reason = signal SIGSEGV: invalid address (fault address: 0x38)
frame #0: 0x0000555555636cd3 test_exe`CGAL::SNC_FM_decorator<CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >::determine_facet(this=0x00007fffffffd390, e=<unavailable>, MinimalEdge=size=1, FacetCycle=0x00007fffffffcbd0, Edge_of=size=4) const at SNC_FM_decorator.h:420:22
417 #endif
418 CGAL_assertion( e_below != SHalfedge_handle() );
419 CGAL_NEF_TRACEN(" edge below " << debug(e_below));
-> 420 Halffacet_handle f = e_below->facet();
421 if ( f != Halffacet_handle() ) return f; // has already a facet
422 // e_below also has no facet
423 f = determine_facet(e_below, MinimalEdge, FacetCycle, Edge_of);
(lldb) thread backtrace
* thread #1, name = 'test_exe', stop reason = signal SIGSEGV: invalid address (fault address: 0x38)
* frame #0: 0x0000555555636cd3 test_exe`CGAL::SNC_FM_decorator<CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >::determine_facet(this=0x00007fffffffd390, e=<unavailable>, MinimalEdge=size=1, FacetCycle=0x00007fffffffcbd0, Edge_of=size=4) const at SNC_FM_decorator.h:420:22
frame #1: 0x000055555565ef26 test_exe`CGAL::SNC_FM_decorator<CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >::create_facet_objects(this=0x00007fffffffd390, plane_supporting_facet=<unavailable>, start=<unavailable>, end=<unavailable>) const at SNC_FM_decorator.h:646:22
frame #2: 0x000055555565fbe2 test_exe`CGAL::SNC_external_structure<CGAL::SNC_indexed_items, CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >::categorize_facet_cycles_and_create_facets(this=0x00007fffffffd640) const at SNC_external_structure.h:1274:7
frame #3: 0x000055555566f48b test_exe`CGAL::SNC_external_structure<CGAL::SNC_indexed_items, CGAL::SNC_structure<CGAL::Epeck, CGAL::SNC_indexed_items, bool> >::build_external_structure(this=0x00007fffffffd640) at SNC_external_structure.h:1371:5
frame #4: 0x0000555555672fad test_exe`CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool>::Nef_polyhedron_3<CGAL::Epeck, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >(CGAL::Polyhedron_3<CGAL::Epeck, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >&) [inlined] CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool>::build_external_structure(this=<unavailable>) at Nef_polyhedron_3.h:352:5
frame #5: 0x0000555555672f8b test_exe`CGAL::Nef_polyhedron_3<CGAL::Epeck, CGAL::SNC_indexed_items, bool>::Nef_polyhedron_3<CGAL::Epeck, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >(this=0x00007fffffffd900, P=0x00007fffffffd920) at Nef_polyhedron_3.h:607
frame #6: 0x00005555555e8234 test_exe`main at test.cpp:29:9
frame #7: 0x00007ffff79640b3 libc.so.6`__libc_start_main + 243
frame #8: 0x00005555555e856e test_exe`_start + 46
Hi there, I was trying to run convex decomposition on the nef_polyhedron, but it's failed with a segfault or looped infinitely.
Issue Details
I used gdb to check what caused the segfault and it's one of the iterators from here: https://github.com/CGAL/cgal/blob/c733c2a9874a9b47a03cbf2bfade32c0a2b51fee/Nef_3/include/CGAL/Nef_3/SNC_external_structure.h#L1320
I understand, that it's not the root of the problem, but just the consequences, but I hope it's can be useful to debug.
Source Code
(I didn't compile it but seems to be valid) broken_mesh1804289383.stl.zip
Environment