mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
mindtct: Check for multiplication overflow in gen_quality_map()
Assert if any of the multiplications, which are then used to allocate memory, would overflow. Closes: #103
This commit is contained in:
@@ -115,6 +115,9 @@ int gen_quality_map(int **oqmap, int *direction_map, int *low_contrast_map,
|
||||
int arrayPos, arrayPos2;
|
||||
int QualOffset;
|
||||
|
||||
ASSERT_SIZE_MUL(map_w, map_h);
|
||||
ASSERT_SIZE_MUL(map_w * map_h, sizeof(int));
|
||||
|
||||
QualMap = (int *)malloc(map_w * map_h * sizeof(int));
|
||||
if(QualMap == (int *)NULL){
|
||||
fprintf(stderr, "ERROR : gen_quality_map : malloc : QualMap\n");
|
||||
|
||||
Reference in New Issue
Block a user