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:
parent
a1e69a0e9d
commit
0372ae8ba5
1 changed files with 3 additions and 0 deletions
|
@ -693,6 +693,9 @@ int alloc_power_stats(int **owis, double **opowmaxs, int **opowmax_dirs,
|
||||||
int *wis, *powmax_dirs;
|
int *wis, *powmax_dirs;
|
||||||
double *powmaxs, *pownorms;
|
double *powmaxs, *pownorms;
|
||||||
|
|
||||||
|
ASSERT_SIZE_MUL(nstats, sizeof(int));
|
||||||
|
ASSERT_SIZE_MUL(nstats, sizeof(double));
|
||||||
|
|
||||||
/* Allocate DFT wave index vector */
|
/* Allocate DFT wave index vector */
|
||||||
wis = (int *)malloc(nstats * sizeof(int));
|
wis = (int *)malloc(nstats * sizeof(int));
|
||||||
if(wis == (int *)NULL){
|
if(wis == (int *)NULL){
|
||||||
|
|
Loading…
Reference in a new issue