MantisBT - Community
View Issue Details
0030203Community[OCCT] OCCT:Modeling Algorithmspublic2018-10-05 02:222019-01-23 19:15
galbramc 
apn 
normalcrash 
verifiedfixed 
[OCCT] 7.3.0 
[OCCT] 7.4.0 
bugs modalg_7 bug30203
0030203: ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d array out of bound
On line 1189 of src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx Param.Value is accessed as Param.Value(tPp+j) where j is initially 1. However, tPp is sometimes equal to the size of Param, hence an out of bounds access occurs. Setting j = 0 on line 1186 or moving up the check "if( (tPp+j) > NbOfPnts ) break;" will prevent this. The following patch simply avoids the array out of bounds:

Index: src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx
===================================================================
--- src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx (revision 1)
+++ src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx (working copy)
@@ -1183,7 +1183,7 @@
         if( tPp != 0 ) {
           gp_Pnt2d aPp = gp_Pnt2d(u,v);
           gp_Pnt2d aPn;
- j = 1;
+ j = 0;
           Standard_Boolean isFound = Standard_False;
           while( !isFound ) {
         Curve->D0( Param.Value(tPp+j), pntproj );
test case
bugs modalg_7 bug30203

test uses files bug30203_curv.brep and bug30203_surf.brep (attached)
No tags attached.
tgz ProjLib_OutOfBound.tgz (2,025) 2018-10-05 02:22
https://tracker.dev.opencascade.org/
? bug30203_curv.brep (421) 2018-10-19 15:57
https://tracker.dev.opencascade.org/
? bug30203_surf.brep (3,861) 2018-10-19 15:57
https://tracker.dev.opencascade.org/
Issue History
2018-10-05 02:22galbramcNew Issue
2018-10-05 02:22galbramcAssigned To => msv
2018-10-05 02:22galbramcFile Added: ProjLib_OutOfBound.tgz
2018-10-05 09:32msvAssigned Tomsv => ifv
2018-10-05 09:32msvStatusnew => assigned
2018-10-05 09:32msvTarget Version => 7.4.0
2018-10-16 17:13gitNote Added: 0080023
2018-10-19 15:28gitNote Added: 0080125
2018-10-19 15:55gitNote Added: 0080129
2018-10-19 15:57ifvFile Added: bug30203_curv.brep
2018-10-19 15:57ifvFile Added: bug30203_surf.brep
2018-10-19 15:59ifvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20173#r20173
2018-10-19 16:01ifvNote Added: 0080131
2018-10-19 16:01ifvAssigned Toifv => msv
2018-10-19 16:01ifvStatusassigned => resolved
2018-10-19 16:01ifvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20174#r20174
2018-10-23 11:09gitNote Added: 0080221
2018-10-23 11:21msvNote Added: 0080223
2018-10-23 11:21msvAssigned Tomsv => bugmaster
2018-10-23 11:21msvStatusresolved => reviewed
2018-10-23 16:09apnTest case number => bugs modalg_7 bug30203
2018-10-23 16:09apnNote Added: 0080235
2018-10-23 16:09apnStatusreviewed => tested
2018-10-28 13:20apnChangeset attached => occt master e5826d91
2018-10-28 13:20apnAssigned Tobugmaster => apn
2018-10-28 13:20apnStatustested => verified
2018-10-28 13:20apnResolutionopen => fixed
2018-10-28 16:13gitNote Added: 0080414

Notes
(0080023)
git   
2018-10-16 17:13   
Branch CR30203 has been created by ifv.

SHA-1: c77cf5ff386e78d0470586ac6b9016e172f56596


Detailed log of new commits:

Author: ifv
Date: Tue Oct 16 17:10:44 2018 +0300

    0030203: ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d array out of bound
(0080125)
git   
2018-10-19 15:28   
Branch CR30203 has been updated forcibly by ifv.

SHA-1: 3488862a1013382deb43203a310fedbc968710ea
(0080129)
git   
2018-10-19 15:55   
Branch CR30203 has been updated forcibly by ifv.

SHA-1: 26269d1a174f0e6abba02a28d830d9dcf1346f55
(0080131)
ifv   
2018-10-19 16:01   
CR30203 is ready for review, test results exist
(0080221)
git   
2018-10-23 11:09   
Branch CR30203 has been updated forcibly by msv.

SHA-1: bbb826366fef8c960778e90cd2f335e779bb9714
(0080223)
msv   
2018-10-23 11:21   
Reviewed.
(0080235)
apn   
2018-10-23 16:09   
Combination -
OCCT branch : CR30203 SHA - bbb826366fef8c960778e90cd2f335e779bb9714
Products branch : master SHA - 35af85def09c66ceeaf90b4e4fb8b54e68d5e98c
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

Test case:
bugs modalg_7 bug30203 - OK

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17650.049999999817 / 17520.90999999988 [+0.74%]
Products
Total CPU difference: 7401.310000000056 / 7462.09000000004 [-0.81%]
Windows-64-VC14:
OCCT
Total CPU difference: 17595.96119389854 / 17666.582846598394 [-0.40%]
Products
Total CPU difference: 8375.615689499997 / 8372.402068899986 [+0.04%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0080414)
git   
2018-10-28 16:13   
Branch CR30203 has been deleted by inv.

SHA-1: bbb826366fef8c960778e90cd2f335e779bb9714