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:
parent
34b316d7d5
commit
49e1e98914
1 changed files with 3 additions and 0 deletions
|
@ -742,6 +742,9 @@ int pixelize_map(int **omap, const int iw, const int ih,
|
||||||
int *blkoffs, bw, bh, bi;
|
int *blkoffs, bw, bh, bi;
|
||||||
int *spptr, *pptr;
|
int *spptr, *pptr;
|
||||||
|
|
||||||
|
ASSERT_SIZE_MUL(iw, ih);
|
||||||
|
ASSERT_SIZE_MUL(iw * ih, sizeof(int));
|
||||||
|
|
||||||
pmap = (int *)malloc(iw*ih*sizeof(int));
|
pmap = (int *)malloc(iw*ih*sizeof(int));
|
||||||
if(pmap == (int *)NULL){
|
if(pmap == (int *)NULL){
|
||||||
fprintf(stderr, "ERROR : pixelize_map : malloc : pmap\n");
|
fprintf(stderr, "ERROR : pixelize_map : malloc : pmap\n");
|
||||||
|
|
Loading…
Reference in a new issue