Archived issue #0030203
ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d array out of bound
Description
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 );
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 );
Steps to reproduce
test case
bugs modalg_7 bug30203
test uses files Attachment 1 (BREP) and Attachment 2 (BREP) (attached)
bugs modalg_7 bug30203
test uses files Attachment 1 (BREP) and Attachment 2 (BREP) (attached)
Public activity
8 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Tue Oct 16 17:10:44 2018 +0300
0030203: ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d array out of bound
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Tue Oct 16 17:10:44 2018 +0300
0030203: ProjLib_ComputeApproxOnPolarSurface::BuildInitialCurve2d array out of bound
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
CR30203 is ready for review, test results exist
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Reviewed.
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
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
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
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
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]