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:
parent
9abc6791c7
commit
34b316d7d5
1 changed files with 2 additions and 0 deletions
|
@ -107,6 +107,8 @@ int allocate_contour(int **ocontour_x, int **ocontour_y,
|
||||||
{
|
{
|
||||||
int *contour_x, *contour_y, *contour_ex, *contour_ey;
|
int *contour_x, *contour_y, *contour_ex, *contour_ey;
|
||||||
|
|
||||||
|
ASSERT_SIZE_MUL(ncontour, sizeof(int));
|
||||||
|
|
||||||
/* Allocate contour's x-coord list. */
|
/* Allocate contour's x-coord list. */
|
||||||
contour_x = (int *)malloc(ncontour*sizeof(int));
|
contour_x = (int *)malloc(ncontour*sizeof(int));
|
||||||
/* If allocation error... */
|
/* If allocation error... */
|
||||||
|
|
Loading…
Reference in a new issue