[libpng17] Use unsigned constants in pngrutil.c buffer length comparisons

This commit is contained in:
Glenn Randers-Pehrson 2015-11-21 14:30:35 -06:00
parent 57e92a8432
commit 5592e0bc96

View File

@ -1530,7 +1530,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr)
++entry_start; ++entry_start;
/* A sample depth should follow the separator, and we should be on it */ /* A sample depth should follow the separator, and we should be on it */
if (length < 2 || entry_start > buffer + (length - 2U)) if (length < 2U || entry_start > buffer + (length - 2U))
{ {
png_chunk_benign_error(png_ptr, "malformed"); png_chunk_benign_error(png_ptr, "malformed");
return; return;
@ -1948,7 +1948,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr)
/* We need to have at least 12 bytes after the purpose string /* We need to have at least 12 bytes after the purpose string
* in order to get the parameter information. * in order to get the parameter information.
*/ */
if (endptr - buf <= 12) if (endptr - buf <= 12U)
{ {
png_chunk_benign_error(png_ptr, "invalid"); png_chunk_benign_error(png_ptr, "invalid");
return; return;