From 0372ae8ba59e397565ac19520b075d15d561a2c1 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 13 Dec 2018 15:40:24 +0100 Subject: [PATCH] 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 --- libfprint/nbis/mindtct/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfprint/nbis/mindtct/init.c b/libfprint/nbis/mindtct/init.c index fd65f9c..9015228 100644 --- a/libfprint/nbis/mindtct/init.c +++ b/libfprint/nbis/mindtct/init.c @@ -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){