mindtct: Check for multiplication overflow in pixelize_map()

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

Closes: #96
This commit is contained in:
Bastien Nocera 2018-12-13 15:30:58 +01:00
parent 34b316d7d5
commit 49e1e98914

View file

@ -742,6 +742,9 @@ int pixelize_map(int **omap, const int iw, const int ih,
int *blkoffs, bw, bh, bi;
int *spptr, *pptr;
ASSERT_SIZE_MUL(iw, ih);
ASSERT_SIZE_MUL(iw * ih, sizeof(int));
pmap = (int *)malloc(iw*ih*sizeof(int));
if(pmap == (int *)NULL){
fprintf(stderr, "ERROR : pixelize_map : malloc : pmap\n");