From 5459823667cc9de14e29959ee95226006a4e0039 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 13 Dec 2018 15:25:37 +0100 Subject: [PATCH] mindtct: Check for multiplication overflow in interpolate_direction_map() Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #100 --- 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 494a4de3..d3a0b44d 100644 --- a/libfprint/nbis/mindtct/maps.c +++ b/libfprint/nbis/mindtct/maps.c @@ -502,6 +502,8 @@ int interpolate_direction_map(int *direction_map, int *low_contrast_map, print2log("INTERPOLATE DIRECTION MAP\n"); /* Allocate output (interpolated) Direction Map. */ + ASSERT_SIZE_MUL(mw, mh); + ASSERT_SIZE_MUL(mw * mh, sizeof(int)); omap = (int *)malloc(mw*mh*sizeof(int)); if(omap == (int *)NULL){ fprintf(stderr,