Skip to content

Commit

Permalink
Fix allocation size
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Mar 5, 2023
1 parent 7dc882f commit 91ba7ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Modelica/Resources/C-Sources/ModelicaStandardTables.c
Expand Up @@ -39,6 +39,10 @@
Modelica.Blocks.Tables.CombiTable2Dv
Changelog:
May 03, 2022: by Hans Olsson, Dassault Systemes
Fixed index-out-of-bounds exception in spline
initialization of 2D tables that actually degrade
to 1D tables (ticket #3983)
Jan. 31, 2022: by Hans Olsson, Dassault Systemes
Added better support for one-sided derivatives of CombiTable2D.
Expand Down Expand Up @@ -6925,7 +6929,7 @@ static CubicHermite2D* spline2DInit(_In_ const double* table, size_t nRow,
return NULL;
}

spline = (CubicHermite2D*)malloc((nCol - 1)*sizeof(CubicHermite2D));
spline = (CubicHermite2D*)malloc((nCol - 2)*sizeof(CubicHermite2D));
if (NULL == spline) {
free(tableT);
return NULL;
Expand Down Expand Up @@ -6957,7 +6961,7 @@ static CubicHermite2D* spline2DInit(_In_ const double* table, size_t nRow,
size_t i;
int cols = 2;

spline = (CubicHermite2D*)malloc((nRow - 1)*sizeof(CubicHermite2D));
spline = (CubicHermite2D*)malloc((nRow - 2)*sizeof(CubicHermite2D));
if (NULL == spline) {
return NULL;
}
Expand Down

0 comments on commit 91ba7ab

Please sign in to comment.