summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2015-01-28 11:12:03 -0600
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2015-01-28 11:12:03 -0600
commitd04c978d2ab25695b1bb50d1f6a7eca5929f5268 (patch)
tree5a2c109ddde9777ef30e610b9a5ec8a43dca752c
parenta7ad81507fb4e906fcce798e524db5307c4e9e0b (diff)
downloadlibpng-1.7.83.tar.gz
[pngcrush] Fixed remaining Coverity-scan warning.v1.7.83
-rw-r--r--pngcrush.c11
-rw-r--r--pngcrush.h17
2 files changed, 12 insertions, 16 deletions
diff --git a/pngcrush.c b/pngcrush.c
index a7184da93..9d590a417 100644
--- a/pngcrush.c
+++ b/pngcrush.c
@@ -2419,8 +2419,7 @@ void png_skip_chunk(png_structp png_ptr)
/* read the length field */
pngcrush_default_read_data(png_ptr, buff, 4);
- length=(unsigned long) buff[3]+(unsigned long) (buff[2]<<8)+
- (unsigned long) (buff[1]<<16)+(unsigned long)(buff[0]<<24);
+ length = png_get_uint_31(png_ptr,buff);
/* read the chunk name */
pngcrush_default_read_data(png_ptr, buff, 4);
if (verbose > 0)
@@ -2428,7 +2427,10 @@ void png_skip_chunk(png_structp png_ptr)
buff[2],buff[3]);
/* skip the data and CRC */
for (ib=0; ib<length+4; ib++)
- pngcrush_default_read_data(png_ptr, buff, 1);
+ {
+ png_byte junk[1] = { 0 };
+ pngcrush_default_read_data(png_ptr, junk, 1);
+ }
}
#ifndef __riscos
@@ -7389,8 +7391,7 @@ png_uint_32 pngcrush_measure_idat(png_structp png_ptr)
unsigned long length;
/* read the MHDR */
pngcrush_default_read_data(png_ptr, buff, 4);
- length=(unsigned long) buff[3]+(unsigned long) (buff[2]<<8)+
- (unsigned long) (buff[1]<<16)+(unsigned long)(buff[0]<<24);
+ length = png_get_uint_31(png_ptr,buff);
if (length > 28)
png_error(png_ptr, "MHDR length too long");
diff --git a/pngcrush.h b/pngcrush.h
index 7e7ee3154..4363ad3ad 100644
--- a/pngcrush.h
+++ b/pngcrush.h
@@ -23,9 +23,6 @@
#undef PNG_READ_ALPHA_MODE_SUPPORTED
#undef PNG_READ_BGR_SUPPORTED
#undef PNG_READ_COMPOSITE_NODIV_SUPPORTED
-#if PNG_LIBPNG_VER >= 10600
-# undef PNG_READ_GAMMA_SUPPORTED
-#endif
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#undef PNG_READ_SWAP_ALPHA_SUPPORTED
@@ -46,14 +43,12 @@
#undef PNG_WRITE_SWAP_SUPPORTED
#undef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-#if PNG_LIBPNG_VER >= 10600
-# undef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
-# undef PNG_SIMPLIFIED_READ_BGR_SUPPORTED
-# undef PNG_SIMPLIFIED_READ_SUPPORTED
-# undef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-# undef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
-# undef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#endif
+#undef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
+#undef PNG_SIMPLIFIED_READ_BGR_SUPPORTED
+#undef PNG_SIMPLIFIED_READ_SUPPORTED
+#undef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+#undef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
+#undef PNG_SIMPLIFIED_WRITE_SUPPORTED
#if PNG_LIBPNG_VER < 10400
/* This allows png_default_error() to return, when it is called after our