[libpng15] Revised test for validity of "num_unknowns" to eliminate compiler

warnings.
This commit is contained in:
John Bowler
2013-01-17 13:09:32 -06:00
committed by Glenn Randers-Pehrson
parent 77a817bfc2
commit bec9ca9b8a
4 changed files with 7 additions and 6 deletions

View File

@@ -1040,9 +1040,10 @@ png_set_unknown_chunks(png_structp png_ptr,
return;
if (num_unknowns < 0 ||
num_unknowns >= INT_MAX-info_ptr->unknown_chunks_num ||
num_unknowns >= PNG_SIZE_MAX/png_sizeof(png_unknown_chunk)
- info_ptr->unknown_chunks_num)
num_unknowns > INT_MAX-info_ptr->unknown_chunks_num ||
(unsigned int)/*SAFE*/(num_unknowns +/*SAFE*/
info_ptr->unknown_chunks_num) >=
PNG_SIZE_MAX/png_sizeof(png_unknown_chunk))
np=NULL;
else