1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation goes beyond the limit

Add test and explanatory comment.
This commit is contained in:
aml
2022-07-04 12:41:15 +03:00
committed by smoskvin
parent 3a2ca49b6d
commit c2eed2a326
3 changed files with 40 additions and 1 deletions

View File

@@ -54,7 +54,10 @@ math_ComputeKronrodPointsAndWeights::math_ComputeKronrodPointsAndWeights(const S
aSubDiag(i) = 0.;
}
// Initialization of temporary data structures.
// Algorithm calculates weights and points symmetrically and uses -1 index
// by design. Memory corruption is avoided by moving pointer `s` to the
// next element and saving original pointer into `ss` for the proper memory
// releasing. Similarly, `t` and `tt` are addressed.
Standard_Integer aNd2 = Number/2;
Standard_Real *s = new Standard_Real[aNd2 + 2];
Standard_Real *t = new Standard_Real[aNd2 + 2];