]> OCCT Git - occt.git/commit
0032930: Modeling Algorithms - Crash in PerformIntersectionAtEnd when no face was...
authorCharlemagne Lasse <charlemagnelasse@gmail.com>
Wed, 13 Apr 2022 09:54:30 +0000 (11:54 +0200)
committerafokin <afokin@opencascade.com>
Fri, 3 Jun 2022 14:48:22 +0000 (17:48 +0300)
commit10a19b2a75f75fb4c3232d26751e40bd6a5f53a1
treef72d83b16889758dbf4072f0cec2308889583277
parentd30f25e6b1a91e5d9de1dd18d3c951274d486103
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>
src/ChFi3d/ChFi3d_Builder_C1.cxx
tests/bugs/modalg_8/bug32930 [new file with mode: 0644]