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
This commit is contained in:
Bastien Nocera 2018-12-13 15:29:20 +01:00
parent 9abc6791c7
commit 34b316d7d5

View file

@ -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... */