Revised to catch negitive values of num_images
This commit is contained in:
parent
d8fe12641e
commit
968cf54a95
|
@ -1957,7 +1957,7 @@ int main(int argc, char **argv)
|
||||||
/* Read directory if necessary */
|
/* Read directory if necessary */
|
||||||
if (img_fol.set_imgdir == 1) {
|
if (img_fol.set_imgdir == 1) {
|
||||||
num_images = get_num_images(img_fol.imgdirpath);
|
num_images = get_num_images(img_fol.imgdirpath);
|
||||||
if((num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)))){
|
if(num_images > SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){
|
||||||
fprintf(stdout, "Max images exceeded\n");
|
fprintf(stdout, "Max images exceeded\n");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto fin;
|
goto fin;
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ int main(int argc, char **argv)
|
||||||
if (img_fol.set_imgdir == 1) {
|
if (img_fol.set_imgdir == 1) {
|
||||||
int it_image;
|
int it_image;
|
||||||
num_images = get_num_images(img_fol.imgdirpath);
|
num_images = get_num_images(img_fol.imgdirpath);
|
||||||
if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN)){
|
if( num_images > SIZE_MAX/(sizeof(char)* OPJ_PATH_LEN) || num_images < 0){
|
||||||
fprintf(stderr, "Max number of images exceeded\n");
|
fprintf(stderr, "Max number of images exceeded\n");
|
||||||
failed = 1;
|
failed = 1;
|
||||||
goto fin;
|
goto fin;
|
||||||
|
|
|
@ -516,7 +516,7 @@ int main(int argc, char *argv[])
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* Stores at max 10 image file names*/
|
/* Stores at max 10 image file names*/
|
||||||
if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char))){
|
if(num_images> SIZE_MAX/(OPJ_PATH_LEN * sizeof(char)) || num_images < 0){
|
||||||
free(dirptr);
|
free(dirptr);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}else{
|
}else{
|
||||||
|
|
Loading…
Reference in New Issue