[libpng15] Use unsigned constants in buffer length comparisons
diff --git a/pngrutil.c b/pngrutil.c
index 429214e..25b8790 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1327,7 +1327,7 @@
/* There should be at least one zero (the compression type byte)
* following the separator, and we should be on it
*/
- if (slength < 1 || profile - png_ptr->chunkdata >= slength - 1)
+ if (slength < 1U || profile >= png_ptr->chunkdata + slength - 1U)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
@@ -1476,7 +1476,8 @@
++entry_start;
/* A sample depth should follow the separator, and we should be on it */
- if (slength < 2 || entry_start - (png_bytep)png_ptr->chunkdata > slength - 2)
+ if (slength < 2U ||
+ entry_start > (png_bytep)png_ptr->chunkdata + slength - 2U)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
@@ -2005,7 +2006,7 @@
/* We need to have at least 12 bytes after the purpose string
* in order to get the parameter information.
*/
- if (endptr -buf <= 12)
+ if (endptr - buf <= 12U)
{
png_warning(png_ptr, "Invalid pCAL data");
png_free(png_ptr, png_ptr->chunkdata);
@@ -2417,7 +2418,7 @@
/* Empty loop */ ;
/* zTXt must have some text after the chunkdataword */
- if (slength < 2 || text - png_ptr->chunkdata >= slength - 2)
+ if (slength < 2U || text >= png_ptr->chunkdata + slength - 2U)
{
png_warning(png_ptr, "Truncated zTXt chunk");
png_free(png_ptr, png_ptr->chunkdata);
@@ -2554,7 +2555,7 @@
* keyword
*/
- if (slength < 3 || png_ptr->chunkdata - lang >= slength - 3)
+ if (slength < 3U || lang >= png_ptr->chunkdata + slength - 3U)
{
png_warning(png_ptr, "Truncated iTXt chunk");
png_free(png_ptr, png_ptr->chunkdata);