From 4fa8c5ec478c92b1a64a114b915cc32e670ab456 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 13 Dec 2018 15:23:48 +0100 Subject: [PATCH] mindtct: Check for multiplication overflow in gen_high_curve_map() Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #101 --- libfprint/nbis/mindtct/maps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libfprint/nbis/mindtct/maps.c b/libfprint/nbis/mindtct/maps.c index 532eefa..494a4de 100644 --- a/libfprint/nbis/mindtct/maps.c +++ b/libfprint/nbis/mindtct/maps.c @@ -898,9 +898,11 @@ int gen_high_curve_map(int **ohcmap, int *direction_map, int bx, by; int nvalid, cmeasure, vmeasure; + ASSERT_INT_MUL(mw, mh); mapsize = mw*mh; /* Allocate High Curvature Map. */ + ASSERT_SIZE_MUL(mapsize, sizeof(int)); high_curve_map = (int *)malloc(mapsize * sizeof(int)); if(high_curve_map == (int *)NULL){ fprintf(stderr,