From: ika Date: Fri, 15 Mar 2013 08:25:31 +0000 (+0400) Subject: 0023822: SIGSEGV 'segmentation violation' during writing IGES X-Git-Tag: V6_6_0_beta~26 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=6db6171400d4bba710a7b087efead0ae662818be 0023822: SIGSEGV 'segmentation violation' during writing IGES checking for infinity coordinates was added. Adding test case for this fix Shape name correction --- diff --git a/src/IGESControl/IGESControl_Writer.cxx b/src/IGESControl/IGESControl_Writer.cxx index b87a39ff2b..db7553fceb 100755 --- a/src/IGESControl/IGESControl_Writer.cxx +++ b/src/IGESControl/IGESControl_Writer.cxx @@ -170,14 +170,16 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape) //#34 22.10.98 rln BUC60081 Bnd_Box box; BRepBndLib::Add (Shape, box); - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - box.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - gs.MaxMaxCoords (gp_XYZ (aXmax / gs.UnitValue(), - aYmax / gs.UnitValue(), - aZmax / gs.UnitValue())); - gs.MaxMaxCoords (gp_XYZ (aXmin / gs.UnitValue(), - aYmin / gs.UnitValue(), - aZmin / gs.UnitValue())); + if (!(box.IsVoid() || box.IsOpenXmax() || box.IsOpenYmax() || box.IsOpenZmax() || box.IsOpenXmin() || box.IsOpenYmin() || box.IsOpenZmin())){ + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + box.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + gs.MaxMaxCoords (gp_XYZ (aXmax / gs.UnitValue(), + aYmax / gs.UnitValue(), + aZmax / gs.UnitValue())); + gs.MaxMaxCoords (gp_XYZ (aXmin / gs.UnitValue(), + aYmin / gs.UnitValue(), + aZmin / gs.UnitValue())); + } themod->SetGlobalSection(gs); diff --git a/tests/bugs/iges/bug23822 b/tests/bugs/iges/bug23822 new file mode 100755 index 0000000000..6e8d27d851 --- /dev/null +++ b/tests/bugs/iges/bug23822 @@ -0,0 +1,14 @@ +puts "========" +puts "CR23822" +puts "========" +puts "" +######################################################### +## SIGSEGV 'segmentation violation' during writing IGES +######################################################### + +ReadIges D [locate_data_file ball_bearing.igs] + +set aFile ${imagedir}/bug23822_new_file.igs +file delete -force ${aFile} + +WriteIges D ${aFile}