MantisBT - Community
View Issue Details
0030202Community[OCCT] OCCT:Modeling Algorithmspublic2018-10-04 22:462019-01-23 19:14
galbramc 
apn 
normalcrash 
verifiedfixed 
[OCCT] 7.3.0 
[OCCT] 7.4.0* 
bugs/modalg_7/bug30202_1, bug30202_2
0030202: IntPatch_WLineTool::JoinWLines array out of bounds
aWLine2 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))
Run the attached code.
No tags attached.
tgz JoinWLines_OutOfBounds.tgz (27,338) 2018-10-04 22:46
https://tracker.dev.opencascade.org/
Issue History
2018-10-04 22:46galbramcNew Issue
2018-10-04 22:46galbramcAssigned To => msv
2018-10-04 22:46galbramcFile Added: JoinWLines_OutOfBounds.tgz
2018-10-04 23:52msvAssigned Tomsv => nbv
2018-10-04 23:52msvStatusnew => assigned
2018-10-04 23:52msvTarget Version => 7.4.0*
2018-10-05 15:40gitNote Added: 0079729
2018-10-08 11:11gitNote Added: 0079778
2018-10-08 13:10nbvNote Added: 0079785
2018-10-08 13:10nbvAssigned Tonbv => msv
2018-10-08 13:10nbvStatusassigned => resolved
2018-10-08 15:09msvNote Added: 0079788
2018-10-08 15:09msvAssigned Tomsv => bugmaster
2018-10-08 15:09msvStatusresolved => reviewed
2018-10-08 15:12gitNote Added: 0079790
2018-10-08 16:09bugmasterTest case number => bugs/modalg_7/bug30202_1, bug30202_2
2018-10-08 16:11bugmasterNote Added: 0079792
2018-10-08 16:11bugmasterStatusreviewed => tested
2018-10-13 16:01apnChangeset attached => occt master dcd768a4
2018-10-13 16:01apnAssigned Tobugmaster => apn
2018-10-13 16:01apnStatustested => verified
2018-10-13 16:01apnResolutionopen => fixed
2018-10-14 13:56gitNote Added: 0079935

Notes
(0079729)
git   
2018-10-05 15:40   
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.
(0079778)
git   
2018-10-08 11:11   
Branch CR30202 has been updated forcibly by nbv.

SHA-1: 1dad93ab4dba53fadd39eda395b2a47939e18d43
(0079785)
nbv   
2018-10-08 13:10   
Dear Mikhail,

Please review the branch CR30202.

Test results are here: http://jenkins-test-12.nnov.opencascade.com/view/CR30202-master_NBV/view/COMPARE/ [^]
(0079788)
msv   
2018-10-08 15:09   
Reviewed.
(0079790)
git   
2018-10-08 15:12   
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

(0079792)
bugmaster   
2018-10-08 16:11   
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
(0079935)
git   
2018-10-14 13:56   
Branch CR30202 has been deleted by inv.

SHA-1: 5c58946f4bdba922f1827b0e08f1ab010e863722