From 5050c8288606f811f5a92f56f22c18bade10ab31 Mon Sep 17 00:00:00 2001 From: ifv Date: Fri, 29 May 2015 11:25:56 +0300 Subject: [PATCH] 0026230: Segmentation fault because a NULL curve is used without precaution in case of a projection failure --- src/BOPTools/BOPTools_AlgoTools2D.cdl | 34 +++++++++++++-------------- src/BOPTools/BOPTools_AlgoTools2D.cxx | 7 ++++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cdl b/src/BOPTools/BOPTools_AlgoTools2D.cdl index 51bd22d407..b7b3c46c33 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cdl +++ b/src/BOPTools/BOPTools_AlgoTools2D.cdl @@ -38,7 +38,8 @@ is aF: Face from TopoDS); ---Purpose: --- Compute P-Curve for the edge on the face - --- + --- Raises exception Standard_ConstructionError if projection algorithm fails + EdgeTangent (myclass; anE : Edge from TopoDS; aT : Real from Standard; @@ -56,8 +57,11 @@ is V : out Real from Standard); ---Purpose: --- Compute surface parameters of the face - --- for the point from the edge at parameter . - --- + --- for the point from the edge at parameter . + --- If has't pcurve on surface, algorithm tries to get it by + --- projection and can + --- raise exception Standard_ConstructionError if projection algorithm fails + CurveOnSurface (myclass; aE: Edge from TopoDS; aF: Face from TopoDS; @@ -67,7 +71,8 @@ is --- Get P-Curve for the edge on surface . --- If the P-Curve does not exist, build it using Make2D(). --- [aToler] - reached tolerance - --- + --- Raises exception Standard_ConstructionError if algorithm Make2D() fails + CurveOnSurface (myclass; aE: Edge from TopoDS; aF: Face from TopoDS; @@ -81,7 +86,8 @@ is --- If the P-Curve does not exist, build it using Make2D(). --- [aFirst, aLast] - range of the P-Curve --- [aToler] - reached tolerance - --- + --- Raises exception Standard_ConstructionError if algorithm Make2D() fails + HasCurveOnSurface (myclass; aE: Edge from TopoDS; aF: Face from TopoDS; @@ -167,18 +173,8 @@ is --- Make P-Curve for the edge on surface . --- [aFirst, aLast] - range of the P-Curve --- [aToler] - reached tolerance - --- + --- Raises exception Standard_ConstructionError if algorithm fails - MakeCurveOnSurface (myclass; - aE: Edge from TopoDS; - aF: Face from TopoDS; - aC : out Curve from Geom2d; - aFirst: out Real from Standard; - aLast : out Real from Standard; - aToler: out Real from Standard); - ---Purpose: - --- Same as Make2D() - --- MakePCurveOnFace (myclass; aF: Face from TopoDS; C3D : Curve from Geom; @@ -187,7 +183,8 @@ is ---Purpose: --- Make P-Curve for the 3D-curve on surface . --- [aToler] - reached tolerance - --- + --- Raises exception Standard_ConstructionError if projection algorithm fails + MakePCurveOnFace (myclass; aF: Face from TopoDS; C3D : Curve from Geom; @@ -199,7 +196,8 @@ is --- Make P-Curve for the 3D-curve on surface . --- [aT1, aT2] - range to build --- [aToler] - reached tolerance - --- + --- Raises exception Standard_ConstructionError if projection algorithm fails + MakePCurveOfType (myclass; PC : ProjectedCurve from ProjLib; aC : out Curve from Geom2d); diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx index 5a3348c8f3..6b60782026 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -652,6 +653,12 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace aTolR = aProj3.GetTolerance(); } } + // + if(aC2D.IsNull()) + { + Standard_ConstructionError::Raise("BOPTools_AlgoTools2D::MakePCurveOnFace : PCurve is Null"); + } + // TolReached2d=aTolR; BOPTools_AlgoTools2D::AdjustPCurveOnFace (aBAS, aT1, aT2, aC2D, aC2DA);