View Issue Details

IDProjectCategoryView StatusLast Update
0033048Open CASCADEOCCT:Foundation Classespublic2023-03-19 19:30
ReporteramlAssigned Toaml 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version7.6.0 
Target Version7.7.0Fixed in Version7.6.3 
Summary0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation goes beyond the limit
DescriptionThis issue is found during studying the results of CppCheck (0033024).

The following block is invalid:

Standard_Integer aNd2 = Number/2;
Standard_Real *s = new Standard_Real[aNd2 + 2];
Standard_Real *t = new Standard_Real[aNd2 + 2];
Standard_Real *ss = s++;
Standard_Real *tt = t++;
  
for (i = -1; i <= aNd2; i++) {
    s[i] = 0.;
    t[i] = 0.;
}

Here, memory is allocated manually without usage of smart pointers (welcome memleaks!) and value is assigned to index -1 that is outside the allowed boundaries [0, aNd2 + 1]. Analysis shows that this class is passed to math::KronrodPointsAndWeights as alternative method of Kronrod poitns and weights calculation for high indices but it seems to be not used.

One should pick one of the following options:
1. Get rid of suspicious class.
2. Identify & fix all the issues, write tests to cover this functionality

_______________________________________________________________________

Analysis revealed that algorithm is OK, and pointer-based raw memory manipulation is correct in this particular case. It is worth adding explanatory comment and test to avoid misunderstanding in future.
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberbugs/fclasses/bug33048

Relationships

related to 0033033 newalukin Coding - collect and fix CppCheck issues - errors 
child of 0033024 assigneddpasukhi Coding - collect and fix CppCheck issues 

Activities

git

2022-07-01 09:11

administrator   ~0109433

Branch CR33048 has been created by aml.

SHA-1: 7c44c17b872b3b72a3b0bea328188739b68aa01b


Detailed log of new commits:

Author: aml
Date: Fri Jul 1 09:10:38 2022 +0300

    0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation go beyond the limit
    
    Remove non-used math_ComputeKronrodPointsAndWeights class.

aml

2022-07-01 11:55

developer   ~0109443

Dear Artem,

It seems this functionality is not used in our tests. Could you please invite IFV and MSV into the discussion?

From my point of view, we should remove this class.

azv

2022-07-02 15:58

administrator   ~0109517

Alexander,

I propose to implement a specific test case, which covers math_ComputeKronrodPointsAndWeights functionality.

azv

2022-07-04 10:28

administrator   ~0109524

Alexander,

 IFV found the DRAW command, which calls the inquiring functionality:
vpropsgk        : vpropsgk name epsilon closed span mode [x y z] [-skip] : compute volumic properties


Hope, this could help you in writing test cases.

git

2022-07-04 12:41

administrator   ~0109529

Branch CR33048 has been updated forcibly by aml.

SHA-1: 2b874eea0c9c9f534225533f0f201a3d67b0c166

git

2022-07-04 12:44

administrator   ~0109530

Branch CR33048 has been updated forcibly by aml.

SHA-1: 6ec018d79dbd712976f037bc0faebb1d4e6a413c

git

2022-07-04 12:46

administrator   ~0109531

Branch CR33048 has been updated forcibly by aml.

SHA-1: 94cf91ba74c411035046a52881013b21c6549ae7

git

2022-07-05 14:18

administrator   ~0109570

Branch CR33048 has been updated forcibly by aml.

SHA-1: 0286a31165ef3bfea5b2e40dee3bdf4e9c6e9d3b

aml

2022-07-05 14:21

developer   ~0109571

Last edited: 2022-07-05 14:26

Analysis revealed that algorithm is OK, and pointer-based raw memory manipulation is correct in this particular case. It is worth adding explanatory comment and test to avoid misunderstanding in future.

git

2022-07-06 06:50

administrator   ~0109587

Branch CR33048 has been updated forcibly by aml.

SHA-1: 0f21ac509eee096ba08538b1e072f0f47e65df28

aml

2022-07-06 06:51

developer   ~0109588

Artem,

Could you please take a look at the CR33048 branch?

- Explanatory comment is added.
- Test case is added.

azv

2022-07-06 07:06

administrator   ~0109589

Branches for integration:
OCCT: CR33048
Products: NO

smoskvin

2022-07-10 11:21

administrator   ~0109708

Combination -
OCCT branch : IR-2022-07-08
master SHA - changes and them, and you can discard any commits you make in this
33c8a72788661285860902f261062e39f32a2d46
changes and them, and you can discard any commits you make in this
e0ceb716c70188b98130b1550914140d0502a6f9
Products branch : IR-2022-07-08 SHA - 79a687f1cd4081ec53ec08c201360e89fce62abc
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: 18685.930000000586 / 18908.870000000694 [-1.18%]
Products
Total CPU difference: 11796.890000000125 / 11832.130000000114 [-0.30%]
Windows-64-VC14:
OCCT
Total CPU difference: 20784.828125 / 20752.59375 [+0.16%]
Products
Total CPU difference: 13361.3125 / 13368.90625 [-0.06%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2022-07-10 12:09

administrator   ~0109741

Branch CR33048 has been deleted by mnt.

SHA-1: 0f21ac509eee096ba08538b1e072f0f47e65df28

Related Changesets

occt: master c2eed2a3

2022-07-04 12:41:15

aml


Committer: smoskvin Details Diff
0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation goes beyond the limit

Add test and explanatory comment.
Affected Issues
0033048
mod - src/math/math_ComputeKronrodPointsAndWeights.cxx Diff File
mod - src/QABugs/QABugs_20.cxx Diff File
add - tests/bugs/fclasses/bug33048 Diff File

Issue History

Date Modified Username Field Change
2022-07-01 09:06 aml New Issue
2022-07-01 09:06 aml Assigned To => aml
2022-07-01 09:09 aml Relationship added child of 0033024
2022-07-01 09:09 aml Relationship added related to 0033033
2022-07-01 09:11 git Note Added: 0109433
2022-07-01 11:55 aml Note Added: 0109443
2022-07-01 11:55 aml Assigned To aml => azv
2022-07-01 11:55 aml Status new => feedback
2022-07-02 15:58 azv Note Added: 0109517
2022-07-02 15:58 azv Assigned To azv => aml
2022-07-04 10:28 azv Note Added: 0109524
2022-07-04 10:28 azv Status feedback => assigned
2022-07-04 12:41 git Note Added: 0109529
2022-07-04 12:44 aml Summary Foundation Classes - math_ComputeKronrodPointsAndWeights indexation go beyond the limit => Foundation Classes - math_ComputeKronrodPointsAndWeights indexation goes beyond the limit
2022-07-04 12:44 git Note Added: 0109530
2022-07-04 12:46 git Note Added: 0109531
2022-07-05 14:18 git Note Added: 0109570
2022-07-05 14:21 aml Description Updated
2022-07-05 14:21 aml Note Added: 0109571
2022-07-05 14:26 aml Note Edited: 0109571
2022-07-05 14:27 aml Description Updated
2022-07-06 06:50 git Note Added: 0109587
2022-07-06 06:51 aml Assigned To aml => azv
2022-07-06 06:51 aml Status assigned => resolved
2022-07-06 06:51 aml Steps to Reproduce Updated
2022-07-06 06:51 aml Note Added: 0109588
2022-07-06 07:06 azv Assigned To azv => bugmaster
2022-07-06 07:06 azv Status resolved => reviewed
2022-07-06 07:06 azv Note Added: 0109589
2022-07-10 11:21 smoskvin Status reviewed => tested
2022-07-10 11:21 smoskvin Note Added: 0109708
2022-07-10 11:23 smoskvin Test case number => bugs/fclasses/bug33048
2022-07-10 12:03 smoskvin Changeset attached => occt master c2eed2a3
2022-07-10 12:03 aml Assigned To bugmaster => aml
2022-07-10 12:03 aml Status tested => verified
2022-07-10 12:03 aml Resolution open => fixed
2022-07-10 12:09 git Note Added: 0109741
2023-03-19 19:30 vglukhik Status verified => closed
2023-03-19 19:30 vglukhik Fixed in Version => 7.6.3