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
This commit is contained in:
parent
4fa8c5ec47
commit
5459823667
1 changed files with 2 additions and 0 deletions
|
@ -502,6 +502,8 @@ int interpolate_direction_map(int *direction_map, int *low_contrast_map,
|
||||||
print2log("INTERPOLATE DIRECTION MAP\n");
|
print2log("INTERPOLATE DIRECTION MAP\n");
|
||||||
|
|
||||||
/* Allocate output (interpolated) Direction Map. */
|
/* Allocate output (interpolated) Direction Map. */
|
||||||
|
ASSERT_SIZE_MUL(mw, mh);
|
||||||
|
ASSERT_SIZE_MUL(mw * mh, sizeof(int));
|
||||||
omap = (int *)malloc(mw*mh*sizeof(int));
|
omap = (int *)malloc(mw*mh*sizeof(int));
|
||||||
if(omap == (int *)NULL){
|
if(omap == (int *)NULL){
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
Loading…
Reference in a new issue