0025453: SIGSEGV in BRepFill_Sweep::BuildShell
authormsv <msv@opencascade.com>
Thu, 11 Dec 2014 12:40:05 +0000 (15:40 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 11 Dec 2014 12:41:12 +0000 (15:41 +0300)
Fixed the bug causing exception when the first edge in generated sweep occurs to be degenerated.

Comments have been added.

Test-case for issue #25453

src/BRepFill/BRepFill_Sweep.cxx
tests/bugs/modalg_5/bug25453 [new file with mode: 0644]

index 99e7a04..ed78845 100644 (file)
@@ -2465,9 +2465,18 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
         }
      
        if (uclose && (isec==NbLaw)) {
-         UpdateEdge(TopoDS::Edge(UEdge(1, ipath)), 
-                    S, !exuv, ULast);
-         UEdge(isec+1, ipath) = UEdge(1, ipath);
+          if (UEdge(1, ipath).IsNull()) //degenerated case
+          {
+            UEdge(isec+1, ipath) = BuildEdge(S, !exuv, ULast, 
+                                             Vertex(isec+1, ipath), 
+                                             Vertex(isec+1, ipath+1),
+                                             myTol3d);
+          }
+          else {
+            UpdateEdge(TopoDS::Edge(UEdge(1, ipath)), 
+                      S, !exuv, ULast);
+            UEdge(isec+1, ipath) = UEdge(1, ipath);
+          }
        }
        else {
           if (UEdge(isec+1, ipath).IsNull())
@@ -2502,9 +2511,18 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
                        S, exuv, VFirst);
        
        if (vclose && (ipath == NbPath)) {
-         UpdateEdge(TopoDS::Edge(VEdge(isec, 1)), 
-                    S, exuv, VLast);
-         VEdge(isec, ipath+1) = VEdge(isec, 1);
+          if (VEdge(isec, 1).IsNull()) //degenerated case
+          {
+            VEdge(isec, ipath+1) = BuildEdge(S, exuv, VLast, 
+                                            Vertex(isec  , ipath+1), 
+                                             Vertex(isec+1, ipath+1),
+                                             myTol3d);
+          }
+          else {
+            UpdateEdge(TopoDS::Edge(VEdge(isec, 1)), 
+                      S, exuv, VLast);
+            VEdge(isec, ipath+1) = VEdge(isec, 1);
+          }
        }
        else if (VEdge(isec, ipath+1).IsNull())
          VEdge(isec, ipath+1) = BuildEdge(S, exuv, VLast, 
diff --git a/tests/bugs/modalg_5/bug25453 b/tests/bugs/modalg_5/bug25453
new file mode 100644 (file)
index 0000000..49f7d15
--- /dev/null
@@ -0,0 +1,22 @@
+puts "========"
+puts "OCC25453"
+puts "========"
+puts ""
+#########################################
+# SIGSEGV in BRepFill_Sweep::BuildShell
+#########################################
+
+smallview
+
+restore [locate_data_file OCC25453_sweep9-draw-Sketch001.brep] Sketch001
+explode Sketch001 E
+wire Sweep-0-spine Sketch001_1
+mksweep Sweep-0-spine
+setsweep -CF
+restore [locate_data_file OCC25453_sweep9-draw-Sketch.brep] Sketch
+trotate Sketch 0 0 0 1 0 0 90
+addsweep Sketch
+buildsweep Sweep -C
+
+fit
+set only_screen_axo 1