summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2018-12-13 15:25:37 +0100
committerBastien Nocera <hadess@hadess.net>2018-12-13 15:48:25 +0100
commit5459823667cc9de14e29959ee95226006a4e0039 (patch)
treee7f4b0b59a9460220a279222ef05a7587f7d6dfe
parent4fa8c5ec478c92b1a64a114b915cc32e670ab456 (diff)
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
-rw-r--r--libfprint/nbis/mindtct/maps.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libfprint/nbis/mindtct/maps.c b/libfprint/nbis/mindtct/maps.c
index 494a4de..d3a0b44 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,