mindtct: Check for multiplication overflow in alloc_power_stats()

Assert if any of the multiplications, which are then used to allocate
memory, would overflow.

Closes: #91
This commit is contained in:
Bastien Nocera 2018-12-13 15:40:24 +01:00
parent a1e69a0e9d
commit 0372ae8ba5

View file

@ -693,6 +693,9 @@ int alloc_power_stats(int **owis, double **opowmaxs, int **opowmax_dirs,
int *wis, *powmax_dirs;
double *powmaxs, *pownorms;
ASSERT_SIZE_MUL(nstats, sizeof(int));
ASSERT_SIZE_MUL(nstats, sizeof(double));
/* Allocate DFT wave index vector */
wis = (int *)malloc(nstats * sizeof(int));
if(wis == (int *)NULL){