mindtct: Check for multiplication overflow in morph_TF_map()

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

Closes: #92
This commit is contained in:
Bastien Nocera 2018-12-13 15:38:46 +01:00
parent 49e1e98914
commit a1e69a0e9d

View file

@ -677,6 +677,7 @@ int morph_TF_map(int *tfmap, const int mw, const int mh,
int *mptr; int *mptr;
int i; int i;
ASSERT_INT_MUL(mw, mh);
/* Convert TRUE/FALSE map into a binary byte image. */ /* Convert TRUE/FALSE map into a binary byte image. */
cimage = (unsigned char *)malloc(mw*mh); cimage = (unsigned char *)malloc(mw*mh);