Added check for integer overflow in get_num_images (#1397)
authorEharve14 <71228603+Eharve14@users.noreply.github.com>
Sat, 15 Jan 2022 14:33:03 +0000 (09:33 -0500)
committerGitHub <noreply@github.com>
Sat, 15 Jan 2022 14:33:03 +0000 (15:33 +0100)
commit6e4588f379be0eb5b62fff65bf96aa1ca556ea96
treefd368e86c7da174acfb1ee45aeba6a534b00b467
parent1daaa0b909aebdf71be36238d16dfbec83c494ed
Added check for integer overflow in get_num_images  (#1397)

As discussed in pull request 1396, added a check for integer overflow.
Change list:
Defined num_images as unsigned int
Moved the if statement to check for an empty directory to the beginning of the read directory section
Added a check to see if num images would roll back to zero when incrementing.
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/bin/jp2/opj_dump.c