View Issue Details

IDProjectCategoryView StatusLast Update
0030202CommunityOCCT:Modeling Algorithmspublic2019-01-23 19:14
Reportergalbramc Assigned Toapn  
PrioritynormalSeveritycrash 
Status closedResolutionfixed 
Product Version7.3.0 
Target Version7.4.0Fixed in Version7.4.0 
Summary0030202: IntPatch_WLineTool::JoinWLines array out of bounds
DescriptionaWLine2 inside IntPatch_WLineTool::JoinWLines may sometimes be length 1, but lines 1489 and 1510 of IntPatch/IntPatch_WLineTool.cxx assume that aWLine2 is at least length 2. The following patch avoids the array out of bound error, but might not function correctly:

Index: src/IntPatch/IntPatch_WLineTool.cxx
===================================================================
--- src/IntPatch/IntPatch_WLineTool.cxx (revision 1)
+++ src/IntPatch/IntPatch_WLineTool.cxx (working copy)
@@ -1485,9 +1485,9 @@
         if (CheckArgumentsToJoin(theS1, theS2, aPntFWL1, aMinRad))
         {
           const Standard_Boolean isFM = (aSqDistF < aSqDistL);
- const IntSurf_PntOn2S& aPt1 = aWLine1->Point(2);
- const IntSurf_PntOn2S& aPt2 = isFM ? aWLine2->Point(2) :
- aWLine2->Point(aNbPntsWL2 - 1);
+ const IntSurf_PntOn2S& aPt1 = aWLine1->Point(Min(2,aNbPntsWL1));
+ const IntSurf_PntOn2S& aPt2 = isFM ? aWLine2->Point(Min(2,aNbPntsWL2)) :
+ aWLine2->Point(Max(1,aNbPntsWL2 - 1));
 
           if (!IsSeamOrBound(aPt1, aPt2, aPntFWL1,
                               anArrPeriods, anArrFBonds, anArrLBonds))
@@ -1506,9 +1506,9 @@
         if (CheckArgumentsToJoin(theS1, theS2, aPntLWL1, aMinRad))
         {
           const Standard_Boolean isFM = (aSqDistF < aSqDistL);
- const IntSurf_PntOn2S& aPt1 = aWLine1->Point(aNbPntsWL1 - 1);
- const IntSurf_PntOn2S& aPt2 = isFM ? aWLine2->Point(2) :
- aWLine2->Point(aNbPntsWL2 - 1);
+ const IntSurf_PntOn2S& aPt1 = aWLine1->Point(Max(1,aNbPntsWL1 - 1));
+ const IntSurf_PntOn2S& aPt2 = isFM ? aWLine2->Point(Min(2,aNbPntsWL2)) :
+ aWLine2->Point(Max(1,aNbPntsWL2 - 1));
 
           if (!IsSeamOrBound(aPt1, aPt2, aPntLWL1,
                               anArrPeriods, anArrFBonds, anArrLBonds))
Steps To ReproduceRun the attached code.
TagsNo tags attached.
Test case numberbugs/modalg_7/bug30202_1, bug30202_2

Attached Files

  • JoinWLines_OutOfBounds.tgz (27,338 bytes)

Activities

galbramc

2018-10-04 22:46

reporter  

JoinWLines_OutOfBounds.tgz (27,338 bytes)

git

2018-10-05 15:40

administrator   ~0079729

Branch CR30202 has been created by nbv.

SHA-1: 7d58bcfd75e3a8e7bacbaef7df497e6c08945360


Detailed log of new commits:

Author: nbv
Date: Fri Oct 5 10:50:51 2018 +0300

    0030202: IntPatch_WLineTool::JoinWLines array out of bounds
    
    The main idea of the fix is that the creation of WLine with one point is forbidden.

git

2018-10-08 11:11

administrator   ~0079778

Branch CR30202 has been updated forcibly by nbv.

SHA-1: 1dad93ab4dba53fadd39eda395b2a47939e18d43

nbv

2018-10-08 13:10

developer   ~0079785

Dear Mikhail,

Please review the branch CR30202.

Test results are here: http://jenkins-test-12.nnov.opencascade.com/view/CR30202-master_NBV/view/COMPARE/

msv

2018-10-08 15:09

developer   ~0079788

Reviewed.

git

2018-10-08 15:12

administrator   ~0079790

Branch CR30202 has been updated by nbv.

SHA-1: 5c58946f4bdba922f1827b0e08f1ab010e863722


Detailed log of new commits:

Author: nbv
Date: Mon Oct 8 15:11:25 2018 +0300

    # Insignificant correction in the code

bugmaster

2018-10-08 16:11

administrator   ~0079792

Combination -
OCCT branch : CR30202 SHA - 1dad93ab4dba53fadd39eda395b2a47939e18d43
Products branch : master SHA - fa672296ba29ad12e59ba21c0c612c412b808a5d
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: 17381.879999999866 / 17385.999999999854 [-0.02%]
Products
Total CPU difference: 7421.370000000055 / 7445.680000000064 [-0.33%]
Windows-64-VC14:
OCCT
Total CPU difference: 17501.861390698596 / 17457.853508598404 [+0.25%]
Products
Total CPU difference: 8355.741162099994 / 8343.292282299992 [+0.15%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2018-10-14 13:56

administrator   ~0079935

Branch CR30202 has been deleted by inv.

SHA-1: 5c58946f4bdba922f1827b0e08f1ab010e863722

Related Changesets

occt: master dcd768a4

2018-10-05 07:50:51

nbv


Committer: apn Details Diff
0030202: IntPatch_WLineTool::JoinWLines array out of bounds

The main idea of the fix is that the creation of WLine with one point is forbidden.
Affected Issues
0030202
mod - src/IntPatch/IntPatch_ImpImpIntersection_4.gxx Diff File
add - tests/bugs/modalg_7/bug30202_1 Diff File
add - tests/bugs/modalg_7/bug30202_2 Diff File

Issue History

Date Modified Username Field Change
2018-10-04 22:46 galbramc New Issue
2018-10-04 22:46 galbramc Assigned To => msv
2018-10-04 22:46 galbramc File Added: JoinWLines_OutOfBounds.tgz
2018-10-04 23:52 msv Assigned To msv => nbv
2018-10-04 23:52 msv Status new => assigned
2018-10-04 23:52 msv Target Version => 7.4.0
2018-10-05 15:40 git Note Added: 0079729
2018-10-08 11:11 git Note Added: 0079778
2018-10-08 13:10 nbv Note Added: 0079785
2018-10-08 13:10 nbv Assigned To nbv => msv
2018-10-08 13:10 nbv Status assigned => resolved
2018-10-08 15:09 msv Note Added: 0079788
2018-10-08 15:09 msv Assigned To msv => bugmaster
2018-10-08 15:09 msv Status resolved => reviewed
2018-10-08 15:12 git Note Added: 0079790
2018-10-08 16:09 bugmaster Test case number => bugs/modalg_7/bug30202_1, bug30202_2
2018-10-08 16:11 bugmaster Note Added: 0079792
2018-10-08 16:11 bugmaster Status reviewed => tested
2018-10-13 16:01 apn Changeset attached => occt master dcd768a4
2018-10-13 16:01 apn Assigned To bugmaster => apn
2018-10-13 16:01 apn Status tested => verified
2018-10-13 16:01 apn Resolution open => fixed
2018-10-14 13:56 git Note Added: 0079935