Commit 34b316d7 authored by Bastien Nocera's avatar Bastien Nocera

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
parent 9abc6791
...@@ -107,6 +107,8 @@ int allocate_contour(int **ocontour_x, int **ocontour_y, ...@@ -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... */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment