cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Access Violation on CGAL::Intersect with specific inputs

Open serban-seeq opened this issue 2 years ago • 4 comments

Issue Details

I found that my call to CGAL::intersection(CGAL::Polygon_with_holes_2<CGAL_Kernel> polygon, CGAL::Polygon_with_holes_2<CGAL_Kernel> global_bounds, std::back_inserter(res)); throws Access Violation runtime error on occasion. After investigating I found that certain inputs(polygon coordinates) to my application trigger this.

Source Code

This arises by using CGAL in my code, but its difficult to provide a minimalist example because its difficult to read the input objects and recreate them in code because the inputs to my application are processed and only later is this data used to call intersection. Would you be able to look at this if I provide a dump file instead? I have a dump file ready with the call stack on libgmp-10.dll.

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Win 11 64-bit
  • Compiler: MSVC 143
  • Release or debug mode: Release
  • Specific flags used (if any):
  • CGAL version: 5.4
  • Boost version: 1.80
  • Other libraries versions if used (Eigen, TBB, etc.): N/A

serban-seeq avatar Dec 17 '23 18:12 serban-seeq

First thing to check is if your polygons are correctly oriented, that is outer boundary is counterclockwise and hole clockwise.

sloriot avatar Dec 18 '23 14:12 sloriot

the polygon in question is 100k+ points. I tried running CGAL::is_valid_polygon_with_holes on it but its taking hours and its not even done the is_closed_polygon_with_holes check

the polygons in question was generated via CGAL::join though. Would that not guarantee a valid polygon list?

CGAL::join(res.begin(), res.end(), std::back_inserter(bnd_inters));
for (const auto& pl : bnd_inters) {
   CGAL::intersection(pl, bound, std::back_inserter(res));
}

the bound polygon is only 4 points and confirmed valid.

serban-seeq avatar Dec 21 '23 16:12 serban-seeq

Would it be possible to share the input so that we can have a look locally? You can send it in private message if it's confidential.

sloriot avatar Jan 19 '24 07:01 sloriot