MantisBT - Community
View Issue Details
0030201Community[OCCT] OCCT:Modeling Algorithmspublic2018-10-04 19:012019-10-11 11:40
galbramc 
jgv 
normalcrash 
assignedopen 
[OCCT] 7.3.0 
[OCCT] 7.5.0* 
0030201: ChFi3d_Builder::PerformMoreThreeCorner segfault by using nullptr
BRep_Tool::CurveOnSurface on lines 2225 and 2235 can set curv2d1 or curv2d2 to null. These variables are then used without checking for the null value leading to a segfault. Throwing an exception in the following patch is a band aid that avoids the segfault, but does not resolve the desire for a fillet.

Index: src/ChFi3d/ChFi3d_Builder_CnCrn.cxx
===================================================================
--- src/ChFi3d/ChFi3d_Builder_CnCrn.cxx (revision 1)
+++ src/ChFi3d/ChFi3d_Builder_CnCrn.cxx (working copy)
@@ -2226,6 +2226,7 @@
                                               u1bid,u2bid);
     else
       Calcul_C2dOnFace(CD.Value(ic),jf.Value(ic),i.Value(ic,icplus),curv2d1);
+ if(curv2d1.IsNull()) throw Standard_ConstructionError("PChFi3d_Builder::PerformMoreThreeCorner : curv2d1 is null");
     p2d1 = curv2d1 ->Value(p.Value(ic,icplus));
     
     // recuperation de la deuxieme courbe 2d
@@ -2237,6 +2238,7 @@
       jfp = 3 - jf.Value(icplus);
       Calcul_C2dOnFace(CD.Value(icplus),jfp,i.Value(icplus,ic),curv2d2);
     }
+ if(curv2d2.IsNull()) throw Standard_ConstructionError("PChFi3d_Builder::PerformMoreThreeCorner : curv2d2 is null");
     p2d2 = curv2d2 ->Value(p.Value(icplus,ic));
 
     Asurf = new GeomAdaptor_HSurface(BRep_Tool::Surface(TopoDS::Face(Fvive.Value(ic,icplus))));
Run attached code with shape.brep.
No tags attached.
related to 0031023verified apn Fillet regression in OCCT 7.4 from 7.3 
tgz ChFi3d_nullptr.tgz (6,763) 2018-10-04 19:01
https://tracker.dev.opencascade.org/
Issue History
2018-10-04 19:01galbramcNew Issue
2018-10-04 19:01galbramcAssigned To => msv
2018-10-04 19:01galbramcFile Added: ChFi3d_nullptr.tgz
2018-10-12 20:41abvTarget Version => 7.4.0
2018-10-15 10:15msvAssigned Tomsv => jgv
2018-10-15 10:15msvStatusnew => assigned
2019-01-23 16:23galbramcNote Added: 0081867
2019-08-12 17:59msvTarget Version7.4.0 => 7.5.0*
2019-10-11 11:40abvRelationship addedrelated to 0031023

Notes
(0081867)
galbramc   
2019-01-23 16:23   
Any luck with getting this use of a null pointer resolved?