fixes to avoid uninitialized or out-of-bounds memory accesses

This commit is contained in:
Axel Kohlmeyer
2023-02-22 23:29:46 -05:00
parent b12facbd54
commit a3ff40ccf0
2 changed files with 7 additions and 0 deletions

View File

@ -90,8 +90,13 @@ void FixWallTable::precompute(int m)
{
double u, mdu;
// always use linear interpolation to determine the offset, since we may be at the
// outer table cutoff and spline interpolation would cause out-of-bounds array accesses
int savedtabstyle = tabstyle;
tabstyle = LINEAR;
uf_lookup(m, cutoff[m], u, mdu);
offset[m] = u;
tabstyle = savedtabstyle;
}
/* ----------------------------------------------------------------------