View Issue Details

IDProjectCategoryView StatusLast Update
0031585CommunityOCCT:Modeling Algorithmspublic2022-03-17 09:11
Reporterabdullah Assigned Tochennes  
PrioritynormalSeveritycrash 
Status verifiedResolutionfixed 
PlatformLinuxOSDebian 6.0 
Product Version7.3.0 
Target Version7.6.2 
Summary0031585: Access Violation while creating fillet - ChFi3d_Builder::PerformIntersectionAtEnd
Description
This bug is reported against, git commit ae58f70718a089f84178d45a1bf9bee586d52d80 (master branch on 30 may 2020, OCC_VERSION 7.4.1). It is also present in 7.3.0.

I attach a patch as a possible solution.

In:

void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)

TopoDS_Edge Edge[nn];

is defined with:

const Standard_Integer nn=15;

At line 2020, in the loop "while (!trouve)"

there is no check of the index nb used for array "Edge", in the example described below, nb takes value 15 => Edge[15] which causes an Access Violation.

I have not investigated the actual reason why it is not found.

The possible solution I propose is to check the index and throw an exception to avoid the crash.
Steps To ReproduceThe original bug submitter notes that creating a test case in Draw is difficult, and that the error was reproduced by running FreeCAD with a particular test case. The downstream ticket may be found at https://github.com/FreeCAD/FreeCAD/issues/5634
Additional information
and documentation updates
diff --git a/src/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ChFi3d/ChFi3d_Builder_C1.cxx
index 369d4dcd7a..339b662691 100644
--- a/src/ChFi3d/ChFi3d_Builder_C1.cxx
+++ b/src/ChFi3d/ChFi3d_Builder_C1.cxx
@@ -2020,0 +2021 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
+ if (nb>=nn) throw Standard_Failure("IntersectionAtEnd : the max number of edges reached");
TagsNo tags attached.
Test case numberNot required

Activities

git

2022-02-13 03:58

administrator   ~0106877

Branch CR31585 has been created by chennes.

SHA-1: b0a5939a3dcddae4ed4edba4d1b56071282fcf4c


Detailed log of new commits:

Author: Chris Hennes
Date: Sat Feb 12 18:52:19 2022 -0600

    0031585: Access Violation while creating fillet - ChiFi3d_Builder::PerformIntersectionAtEnd
    
    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.

chennes

2022-02-13 04:06

developer   ~0106878

Rather than directly use the patch proposed by the bug submitter, for consistency I copied a line from earlier in the same function that was making this check and throwing the exception. It uses an older code style (matching the rest of the file), and is throwing a very generic exception. It may be more appropriate to use the more modern coding style, and a more specific exception type, such as Standard_ConstructionError.

msv

2022-02-14 10:17

developer   ~0106883

Test job http://jenkins-test-occt/view/CR31585-master-MSV/view/COMPARE/

msv

2022-02-14 12:29

developer   ~0106888

For integration:
occt - CR31585
products - none

smoskvin

2022-02-19 11:34

administrator   ~0106983

Combination -
OCCT branch : IR-2022-02-18
master SHA - 600ee856316c1a9eb340779b32de511b74465896
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2022-02-18 SHA - 859115827d7f98f21dc3e653fecea4c712aae052
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18496.730000000363 / 18543.560000000383 [-0.25%]
Products
Total CPU difference: 11705.020000000135 / 11696.60000000009 [+0.07%]
Windows-64-VC14:
OCCT
Total CPU difference: 20453.203125 / 20387.28125 [+0.32%]
Products
Total CPU difference: 13176.3125 / 13150.390625 [+0.20%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2022-02-19 12:57

administrator   ~0106989

Branch CR31585 has been deleted by mnt.

SHA-1: b0a5939a3dcddae4ed4edba4d1b56071282fcf4c

Related Changesets

occt: master f91202f3

2022-02-13 03:52:19

chennes


Committer: smoskvin Details Diff
0031585: Access Violation while creating fillet - ChiFi3d_Builder::PerformIntersectionAtEnd

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.
Affected Issues
0031585
mod - src/ChFi3d/ChFi3d_Builder_C1.cxx Diff File

Issue History

Date Modified Username Field Change
2020-05-30 16:55 abdullah New Issue
2020-05-30 16:55 abdullah Assigned To => msv
2022-02-13 03:58 git Note Added: 0106877
2022-02-13 04:06 chennes Status new => resolved
2022-02-13 04:06 chennes Steps to Reproduce Updated
2022-02-13 04:06 chennes Note Added: 0106878
2022-02-14 10:17 msv Note Added: 0106883
2022-02-14 12:29 msv Assigned To msv => bugmaster
2022-02-14 12:29 msv Status resolved => reviewed
2022-02-14 12:29 msv Note Added: 0106888
2022-02-19 11:34 smoskvin Status reviewed => tested
2022-02-19 11:34 smoskvin Note Added: 0106983
2022-02-19 11:37 smoskvin Test case number => Not required
2022-02-19 12:43 smoskvin Changeset attached => occt master f91202f3
2022-02-19 12:43 chennes Assigned To bugmaster => chennes
2022-02-19 12:43 chennes Status tested => verified
2022-02-19 12:43 chennes Resolution open => fixed
2022-02-19 12:57 git Note Added: 0106989
2022-03-17 09:11 azv Target Version => 7.6.2