]> OCCT Git - occt.git/commitdiff
Data Exchange - IGES Import Degenerated BSpline crash #368
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Fri, 14 Feb 2025 13:13:53 +0000 (14:13 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2025 13:13:53 +0000 (13:13 +0000)
Degenerated bspline leads to null dereference
Fix BSpline curve check and improve exception handling in TransferBSplineCurve

src/IGESToBRep/IGESToBRep_BasicCurve.cxx

index 70aacdd3716e587cd50d275efe3094d47a6d1029..e071bfc7d45580fae6a9856d73d47cb4dca6a122 100644 (file)
@@ -1130,9 +1130,11 @@ Handle(Geom_Curve) IGESToBRep_BasicCurve::TransferBSplineCurve(
     //: 5    BSplineC = new Geom_BSplineCurve(Poles, Weight, Knot, Mult, Degree);
   }
 
-  // sln 29.12.2001 OCC90 : If curve can not be created do nothing
-  if (!checkBSplineCurve(this, start, Knot, Weight))
+  // If curve can not be created do nothing
+  if (Poles.Size() < 2 || !checkBSplineCurve(this, start, Knot, Weight))
+  {
     return BSplineRes;
+  }
 
   {
     try
@@ -1151,6 +1153,7 @@ Handle(Geom_Curve) IGESToBRep_BasicCurve::TransferBSplineCurve(
       anException.Print(std::cout);
 #endif
       (void)anException;
+      return BSplineRes;
     }
   }