From 49e1e98914d9ebf83e85154f25718095bd21226b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 13 Dec 2018 15:30:58 +0100 Subject: [PATCH] mindtct: Check for multiplication overflow in pixelize_map() Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #96 --- libfprint/nbis/mindtct/maps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfprint/nbis/mindtct/maps.c b/libfprint/nbis/mindtct/maps.c index 12c716f8..239005f0 100644 --- a/libfprint/nbis/mindtct/maps.c +++ b/libfprint/nbis/mindtct/maps.c @@ -742,6 +742,9 @@ int pixelize_map(int **omap, const int iw, const int ih, int *blkoffs, bw, bh, bi; int *spptr, *pptr; + ASSERT_SIZE_MUL(iw, ih); + ASSERT_SIZE_MUL(iw * ih, sizeof(int)); + pmap = (int *)malloc(iw*ih*sizeof(int)); if(pmap == (int *)NULL){ fprintf(stderr, "ERROR : pixelize_map : malloc : pmap\n");