mindtct: Check for multiplication overflow in gen_high_curve_map()
Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #101
This commit is contained in:
parent
239034714f
commit
4fa8c5ec47
1 changed files with 2 additions and 0 deletions
|
@ -898,9 +898,11 @@ int gen_high_curve_map(int **ohcmap, int *direction_map,
|
||||||
int bx, by;
|
int bx, by;
|
||||||
int nvalid, cmeasure, vmeasure;
|
int nvalid, cmeasure, vmeasure;
|
||||||
|
|
||||||
|
ASSERT_INT_MUL(mw, mh);
|
||||||
mapsize = mw*mh;
|
mapsize = mw*mh;
|
||||||
|
|
||||||
/* Allocate High Curvature Map. */
|
/* Allocate High Curvature Map. */
|
||||||
|
ASSERT_SIZE_MUL(mapsize, sizeof(int));
|
||||||
high_curve_map = (int *)malloc(mapsize * sizeof(int));
|
high_curve_map = (int *)malloc(mapsize * sizeof(int));
|
||||||
if(high_curve_map == (int *)NULL){
|
if(high_curve_map == (int *)NULL){
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
Loading…
Reference in a new issue