Modeling Algorithms - use the adaptor's NbPoles() in BRepGProp_EdgeTool::IntegrationOrder#1382
Open
gsdali wants to merge 3 commits into
Open
Conversation
…ol::IntegrationOrder BRepGProp::LinearProperties crashes (uncatchable SIGSEGV) computing the integration order for a Bezier- or BSpline-type edge that has no 3D curve, only a curve-on-surface (pcurve) representation with that curve type -- the common case for a degenerate edge produced by BRepBuilderAPI_Sewing when it merges near-coincident vertices between two faces that don't share an edge outright. Root cause: IntegrationOrder branches on BAC.GetType() (a BRepAdaptor_Curve), which correctly reports the curve-on-surface pcurve's type via GeomAdaptor_TransformedCurve::GetType()'s override, but then reads the pole count via a completely different, non-virtual path: BAC.Curve().Curve(), down-cast to Geom_BezierCurve/Geom_BSplineCurve. BAC.Curve() returns the base GeomAdaptor_Curve sub-object, which holds the 3D-curve representation only -- it is never Load()ed when the edge has no 3D curve, so the handle is null, the down_cast returns null, and ->NbPoles() dereferences it. GeomAdaptor_TransformedCurve already has a correctly-dispatching NbPoles() override next to GetType() in the same header. Calling BAC.NbPoles() instead fixes the crash and matches the accessor GetType() one line above it already uses -- no cast, no null check needed, and no behaviour change for an edge that does have a 3D curve. Reported downstream and isolated at SecondMouseAU/OCCTSwift#318.
… curve-on-surface crash (Open-Cascade-SAS#318) Regression test for the fix in the previous commit: a degenerate edge whose sole geometric representation is a Bezier/BSpline-type curve-on-surface pcurve (no 3D curve) used to SIGSEGV inside IntegrationOrder. Verifies LinearProperties completes and returns a finite, non-negative length.
…TColStd aliases TColgp_Array1OfPnt2d.hxx, TColStd_Array1OfInteger.hxx and TColStd_Array1OfReal.hxx moved to src/Deprecated/NCollectionAliases in OCCT 8.0.0; that toolkit isn't on TKTopAlgo's GTest include path, so CI failed with a missing-header error on all platforms. Geom2d_BSplineCurve already takes NCollection_Array1<T> natively.
dpasukhi
self-requested a review
July 22, 2026 14:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1381.
Problem
BRepGProp::LinearProperties()(and anything built onBRepGProp_Cinert) SIGSEGVs computing theintegration order for an edge whose only curve geometry is a Bezier- or BSpline-type
curve-on-surface (pcurve) — an edge with no 3D curve, the common case for a degenerate edge
BRepBuilderAPI_Sewingproduces reconciling near-coincident vertices between two faces that don'tshare an edge outright.
Root cause
IntegrationOrderbranches onBAC.GetType(), which correctly reports the curve-on-surfacepcurve's type via
GeomAdaptor_TransformedCurve::GetType()'s override:but then read the pole count via a completely different, non-virtual path —
BAC.Curve().Curve(),down-cast to
Geom_BezierCurve/Geom_BSplineCurve.BAC.Curve()returns the baseGeomAdaptor_Curvesub-object, which holds the 3D-curve representation only: it is neverLoad()edwhen the edge has no 3D curve, so the handle is null, the down-cast returns null, and
->NbPoles()dereferences it.
Fix
GeomAdaptor_TransformedCurvealready has a correctly-dispatchingNbPoles()override right nextto
GetType()in the same header:Calling
BAC.NbPoles()instead of manually re-deriving the pole count fromBAC.Curve()fixes thecrash and matches the accessor
GetType()one line above it already uses — no cast, no null checkneeded, and no behaviour change for an edge that does have a 3D curve (
myConSurf.IsNull()there,so
NbPoles()resolves to the samemyCurve.NbPoles()the removed code reached by hand).Reproducer / test
Added as
BRepGPropTest.LinearProperties_DegenerateEdgeWithBSplinePCurveNoCrashin the existingBRepGProp_Test.cxx.