Title: ifcgeom: cap wire_intersections recursion to prevent a stack overflow (#622) by petruconduraru · Pull Request #8465 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: ifcgeom: cap wire_intersections recursion to prevent a stack overflow (#622) by petruconduraru · Pull Request #8465 · IfcOpenShell/IfcOpenShell
X Title: ifcgeom: cap wire_intersections recursion to prevent a stack overflow (#622) by petruconduraru · Pull Request #8465 · IfcOpenShell/IfcOpenShell
Description: Fixes #622. Problem wire_intersections() recurses once for every self-intersection loop it splits off. On a degenerate or self-intersecting boundary that recursion is unbounded and overflows the stack, crashing the process (the reporter hit it around the 80th nested frame on SampleHouse.ifc). Fix Add a thread_local recursion-depth counter with an RAII guard at the top of the function. Once the depth exceeds 32 it logs a GEO 328 warning and bails out gracefully by appending the wire unmodified and returning false, the same fallback the function already uses for non-closed and n < 3 wires. thread_local because the geometry iterator can run several OCCT kernels concurrently, so a shared counter would be wrong. The RAII guard keeps the counter correct across every return path, including the existing throw geometry_exception. No signature or ABI change, so the bounding-box broad-phase added for #5999 later in the same function is untouched. The cap of 32 sits well below the observed ~80-frame overflow while leaving ample headroom for legitimate multi-loop boundaries. Verification Reasoned against the self-recursive call site and the existing fallback pattern; Logger::Root().Warning and the wires.Append(wire) fallback both mirror existing usage in this file. Not runtime-tested (no local kernel build); compilation is covered by CI's build-ifcopenshell. Generated with the assistance of an AI coding tool.
Open Graph Description: Fixes #622. Problem wire_intersections() recurses once for every self-intersection loop it splits off. On a degenerate or self-intersecting boundary that recursion is unbounded and overflows the st...
X Description: Fixes #622. Problem wire_intersections() recurses once for every self-intersection loop it splits off. On a degenerate or self-intersecting boundary that recursion is unbounded and overflows the st...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8465
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:247d2628-a99a-874a-31c7-5b23e451d466 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8072:2B7161:9AB3F3:CD72E7:6B04F557 |
| html-safe-nonce | fcbdb7a176a4b6aa89c9f369e2824defe4f6b24d89c5733176acb2446cc85dcb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDcyOjJCNzE2MTo5QUIzRjM6Q0Q3MkU3OjZCMDRGNTU3IiwidmlzaXRvcl9pZCI6IjQ4NTc3NDI2OTA4NjA5ODc3MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 056847cfd2908f3eb53c6ecb4810ae06cd7ca4d8f99912a80b1f4add43f770ad |
| hovercard-subject-tag | pull_request:4029569150 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/IfcOpenShell/IfcOpenShell/pull/8465/files |
| twitter:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| og:image:alt | Fixes #622. Problem wire_intersections() recurses once for every self-intersection loop it splits off. On a degenerate or self-intersecting boundary that recursion is unbounded and overflows the st... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2c3971d6ab4be607cf9a26ac26ef0a7bfce380ec2ba14642e64028ad07a492b9 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3f1d45dee14b3f87c64e9017a9c08d011561786 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width