From 34b316d7d5ff4ec6abf8ae61e27fd82d08fd21cf Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 13 Dec 2018 15:29:20 +0100 Subject: [PATCH] mindtct: Check for multiplication overflow in allocate_contour() Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #97 --- libfprint/nbis/mindtct/contour.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libfprint/nbis/mindtct/contour.c b/libfprint/nbis/mindtct/contour.c index 3361047..5d802c2 100644 --- a/libfprint/nbis/mindtct/contour.c +++ b/libfprint/nbis/mindtct/contour.c @@ -107,6 +107,8 @@ int allocate_contour(int **ocontour_x, int **ocontour_y, { int *contour_x, *contour_y, *contour_ex, *contour_ey; + ASSERT_SIZE_MUL(ncontour, sizeof(int)); + /* Allocate contour's x-coord list. */ contour_x = (int *)malloc(ncontour*sizeof(int)); /* If allocation error... */