mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
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:
@@ -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){
|
||||||
|
|||||||
Reference in New Issue
Block a user