Commit e4d1f3a3 authored by Bastien Nocera's avatar Bastien Nocera

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
parent fd7d24c5
Pipeline #12092 failed with stages
in 2 minutes and 32 seconds
......@@ -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){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment