0031585: Access Violation while creating fillet - ChiFi3d_Builder::PerformIntersectio...
authorChris Hennes <chennes@pioneerlibrarysystem.org>
Sun, 13 Feb 2022 00:52:19 +0000 (18:52 -0600)
committersmoskvin <smoskvin@opencascade.com>
Mon, 14 Feb 2022 19:02:07 +0000 (22:02 +0300)
There is one case in PerformIntersectionAtEnd that did not test whether
an array access exceeded the length of the array, in rare cases
resulting in a segmentation fault. That error-handling behavior is
replaced by the exception code used elsewhere in the function. For
consistency, the code is copied exactly as implemented elsewhere. This
code has the same effect as that proposed by the bug submitter.

src/ChFi3d/ChFi3d_Builder_C1.cxx

index 8a0da73..d4e48a4 100644 (file)
@@ -1997,6 +1997,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
       if ((possible1 && possible2) || (!possible1 && !possible2) || (nbarete > 4)) {
        while (!trouve) {
          nb++;
+         if (nb>=nn) throw Standard_Failure("IntersectionAtEnd : the max number of faces reached");
          if (nb!=1) F3=Face[nb-2];
          Face[nb-1]=F3;
          if (CV1.Arc().IsSame(edgelibre1))