[libpng17] Check (png_uint_16) casts for overflow. Also removed png_muldiv_warn,

added RELEASE/!RELEASE convenience macros. png_muldiv_warn was used in
only one place, and the overflow condition is a genuine warning not
an internal error.  Four macros allow code or function parameters to be
condition on RELEASE (or not) builds and tidy up the #ifdef handling of
functions.
This commit is contained in:
John Bowler
2015-03-22 20:26:13 -05:00
committed by Glenn Randers-Pehrson
parent 36562c1032
commit 53097f5bbb
14 changed files with 265 additions and 249 deletions

View File

@@ -1812,7 +1812,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
png_crc_read(png_ptr, readbuf, length);
png_ptr->num_trans = (png_uint_16)length;
png_ptr->num_trans = png_check_u16(png_ptr, length);
}
else
@@ -1907,9 +1907,11 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
return;
}
background.red = (png_uint_16)png_ptr->palette[buf[0]].red;
background.green = (png_uint_16)png_ptr->palette[buf[0]].green;
background.blue = (png_uint_16)png_ptr->palette[buf[0]].blue;
background.red = png_check_u16(png_ptr, png_ptr->palette[buf[0]].red);
background.green =
png_check_u16(png_ptr, png_ptr->palette[buf[0]].green);
background.blue =
png_check_u16(png_ptr, png_ptr->palette[buf[0]].blue);
}
else