occt: master 10a19b2a

Author Committer Branch Timestamp Parent
CharlemagneLasse afokin master 2022-04-13 12:54:30 master d30f25e6
Affected Issues  0032930: Modeling Algorithms - Crash in PerformIntersectionAtEnd when no face was found
Changeset 0032930: Modeling Algorithms - Crash in PerformIntersectionAtEnd when no face was found

The PerformIntersectionAtEnd code is currently not handling all the faces
correctly. If it retrieves Face[0] as F, it can happen that the previously
ran code didn't actually retrieve any faces in this array at all.

For example when:

* "if (nface==3)" is true
  - "if (!findonf1)" is true (doesn't assign any faces to this array)
  - "if (!findonf2)" is true (doesn't assign any faces to this array)
  - "if (state == ChFiDS_OnSame)" is not true (because it is
    ChFiDS_AllSame)
  - "if (findonf1 && !isOnSame1)" cannot be true (see above, but would
    handle faces)
  - "if (findonf2 && !isOnSame2)" cannot be true (see above, but would
    handle faces)
  - "if (isOnSame2)" is false (but would also handle faces)

Since no faces were assigned here, F would be a NULL face. As result, the
function will crash when trying to access the Surface behind the face via
`BRep_Tool::Surface(F);`.

While the best approach would be to identify the implementation bug in the
algorithm behind PerformIntersectionAtEnd, a check + exception is used
instead because the actual algorithm is not known.

Signed-off-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
mod - src/ChFi3d/ChFi3d_Builder_C1.cxx Diff File
add - tests/bugs/modalg_8/bug32930 Diff File