mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
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:
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user