0023822: SIGSEGV 'segmentation violation' during writing IGES
authorika <ika@opencascade.com>
Fri, 15 Mar 2013 08:25:31 +0000 (12:25 +0400)
committerika <ika@opencascade.com>
Fri, 15 Mar 2013 08:25:31 +0000 (12:25 +0400)
checking for infinity coordinates was added.
Adding test case for this fix
Shape name correction

src/IGESControl/IGESControl_Writer.cxx
tests/bugs/iges/bug23822 [new file with mode: 0755]

index b87a39f..db7553f 100755 (executable)
@@ -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 (executable)
index 0000000..6e8d27d
--- /dev/null
@@ -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}