0023722: stack overflow during reading IGES in Test Harness
authorika <ika@opencascade.com>
Fri, 8 Feb 2013 10:56:38 +0000 (14:56 +0400)
committerika <ika@opencascade.com>
Fri, 8 Feb 2013 10:56:38 +0000 (14:56 +0400)
Add creation a new vertex before replace.
Adding of test cases for CR23722

src/ShapeFix/ShapeFix_IntersectionTool.cxx
tests/bugs/heal/bug23722 [new file with mode: 0755]

index ad65d7a..8b78518 100755 (executable)
@@ -1226,30 +1226,31 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
                 TopoDS_Edge tmpE,SegE;
                 // split edge1
                 Standard_Integer akey1=0, akey2=0;
+                Standard_Real newTolerance;
                 // analysis fo P01
-                if(P01.Distance(PV1)<Max(tolV1,BRep_Tool::Tolerance(V1))) {
-                  NewV1 = V1;
-                  if(tolV1>BRep_Tool::Tolerance(V1))
-                    B.UpdateVertex(NewV1,tolV1);
+                newTolerance = Max(tolV1,BRep_Tool::Tolerance(V1));
+                if(P01.Distance(PV1)<newTolerance) {
+                  B.MakeVertex(NewV1,BRep_Tool::Pnt(V1),newTolerance);
+                  NewV1.Orientation(V1.Orientation());
                   akey1++;
                 }
-                if(P01.Distance(PV2)<Max(tolV1,BRep_Tool::Tolerance(V2))) {
-                  NewV1 = V2;
-                  if(tolV1>BRep_Tool::Tolerance(V2))
-                    B.UpdateVertex(NewV1,tolV1);
+                newTolerance = Max(tolV1,BRep_Tool::Tolerance(V2));
+                if(P01.Distance(PV2)<newTolerance) {
+                  B.MakeVertex(NewV1,BRep_Tool::Pnt(V2),newTolerance);
+                  NewV1.Orientation(V2.Orientation());
                   akey1++;
                 }
                 // analysis fo P02
-                if(P02.Distance(PV1)<Max(tolV2,BRep_Tool::Tolerance(V1))) {
-                  NewV2 = V1;
-                  if(tolV2>BRep_Tool::Tolerance(V1))
-                    B.UpdateVertex(NewV2,tolV2);
+                newTolerance = Max(tolV2,BRep_Tool::Tolerance(V1));
+                if(P02.Distance(PV1)<newTolerance) {
+                  B.MakeVertex(NewV2,BRep_Tool::Pnt(V1),newTolerance);
+                  NewV2.Orientation(V1.Orientation());
                   akey2++;
                 }
-                if(P02.Distance(PV2)<Max(tolV2,BRep_Tool::Tolerance(V2))) {
-                  NewV2 = V2;
-                  if(tolV2>BRep_Tool::Tolerance(V2))
-                    B.UpdateVertex(NewV2,tolV2);
+                newTolerance = Max(tolV2,BRep_Tool::Tolerance(V2));
+                if(P02.Distance(PV2)<newTolerance) {
+                  B.MakeVertex(NewV2,BRep_Tool::Pnt(V2),newTolerance);
+                  NewV2.Orientation(V2.Orientation());
                   akey2++;
                 }
                 if( akey1>1 || akey2>1 ) continue;
diff --git a/tests/bugs/heal/bug23722 b/tests/bugs/heal/bug23722
new file mode 100755 (executable)
index 0000000..0afa733
--- /dev/null
@@ -0,0 +1,13 @@
+puts "========"
+puts "CR23722"
+puts "========"
+puts ""
+#############################
+## stack overflow during reading IGES in Test Harness
+#############################
+
+restore [locate_data_file bug23722_face.brep]
+
+brepiges bug23722_face ${imagedir}/face.igs
+
+igesbrep ${imagedir}/face.igs a *