Commit 54598236 authored by Bastien Nocera's avatar Bastien Nocera

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
parent 4fa8c5ec
......@@ -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,
......
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