]> OCCT Git - occt.git/commitdiff
Modeling - SIGSEGV BRepAdaptor_Curve2d and UnifySameDomain #372
authorjfa <jfa@opencascade.com>
Tue, 17 Oct 2023 09:06:58 +0000 (10:06 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 17 Feb 2025 11:12:21 +0000 (11:12 +0000)
SIGSEGV with MakeVertexInsideFace.
Fixed exceptions with loading null curve and using out of range index.
By K.Leontev. [bos #37951]

src/BRepAdaptor/BRepAdaptor_Curve2d.cxx
src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx

index 4e698fd2c2efc2c4c40e1dce27f119a200a1238e..d50b0b3cd78b111a90e05a405e3355878b50b2a5 100644 (file)
@@ -57,9 +57,12 @@ void BRepAdaptor_Curve2d::Initialize(const TopoDS_Edge& E, const TopoDS_Face& F)
 {
   myEdge = E;
   myFace = F;
-  Standard_Real              pf, pl;
-  const Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(E, F, pf, pl);
-  Geom2dAdaptor_Curve::Load(PC, pf, pl);
+  Standard_Real              aFirs, aLast;
+  const Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(E, F, aFirs, aLast);
+  if (!aPCurve.IsNull())
+  {
+    Geom2dAdaptor_Curve::Load(aPCurve, aFirs, aLast);
+  }
 }
 
 //=================================================================================================
index 9ecee9ae1ce13cba38f9754e52cd8c21c65273b9..679db8b99c5282ff9c391ff0cc69caeb1ae370a0 100644 (file)
@@ -435,9 +435,17 @@ static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape&
   theNumberOfIntervals = aPairSeq.Length();
 
   if (aPairSeq.Length() == 2)
+  {
     theMinCoord = aPairSeq(2).first - thePeriod;
-  else
+  }
+  else if (aPairSeq.Length() > 0)
+  {
     theMinCoord = aPairSeq(1).first;
+  }
+  else
+  {
+    return Standard_False;
+  }
 
   theMaxCoord = aPairSeq(1).second;
   return Standard_True;