Commit 4fa8c5ec authored by Bastien Nocera's avatar Bastien Nocera

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
parent 23903471
......@@ -898,9 +898,11 @@ int gen_high_curve_map(int **ohcmap, int *direction_map,
int bx, by;
int nvalid, cmeasure, vmeasure;
mapsize = mw*mh;
/* Allocate High Curvature Map. */
ASSERT_SIZE_MUL(mapsize, sizeof(int));
high_curve_map = (int *)malloc(mapsize * sizeof(int));
if(high_curve_map == (int *)NULL){
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