mindtct: Check for multiplication overflow in gen_initial_maps()

Assert if any of the multiplications, which are then used to allocate
memory, would overflow.

Closes: #99
This commit is contained in:
Bastien Nocera 2018-12-13 15:27:12 +01:00
parent 5459823667
commit 9abc6791c7

View file

@ -272,6 +272,7 @@ int gen_initial_maps(int **odmap, int **olcmap, int **olfmap,
print2log("INITIAL MAP\n"); print2log("INITIAL MAP\n");
/* Compute total number of blocks in map */ /* Compute total number of blocks in map */
ASSERT_INT_MUL(mw, mh);
bsize = mw * mh; bsize = mw * mh;
/* Allocate Direction Map memory */ /* Allocate Direction Map memory */