[libpng12] Quieted some Coverity-scan warnings

This commit is contained in:
Glenn Randers-Pehrson 2015-02-05 21:32:29 -06:00
parent 6e6d4a7ce4
commit a1981c64e3
10 changed files with 34 additions and 30 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.53beta02 - February 5, 2015
Libpng 1.2.53beta02 - February 6, 2015
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -45,7 +45,7 @@ Changes since the last public release (1.2.52):
version 1.2.53beta01 [omitted]
version 1.2.53beta02 [%RDATE%]
version 1.2.53beta02 [February 6, 2015]
Issue a png_error() instead of a png_warning() when width is
potentially too large for the architecture, in case the calling
application has overridden the default 1,000,000-column limit

View File

@ -2830,7 +2830,7 @@ version 1.0.62 and 1.2.52 [November 20, 2014]
version 1.2.53beta01 [omitted]
version 1.2.53beta02 [%RDATE%]
version 1.2.53beta02 [February 6, 2015]
Issue a png_error() instead of a png_warning() when width is
potentially too large for the architecture, in case the calling
application has overridden the default 1,000,000-column limit

16
png.c
View File

@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.2.51 [February 6, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@ -158,12 +158,16 @@ voidpf /* PRIVATE */
png_zalloc(voidpf png_ptr, uInt items, uInt size)
{
png_voidp ptr;
png_structp p=(png_structp)png_ptr;
png_uint_32 save_flags=p->flags;
png_structp p;
png_uint_32 save_flags;
png_uint_32 num_bytes;
if (png_ptr == NULL)
return (NULL);
p=(png_structp)png_ptr;
save_flags=p->flags;
if (items > PNG_UINT_32_MAX/size)
{
png_warning (p, "Potential overflow in png_zalloc()");
@ -724,13 +728,13 @@ png_get_copyright(png_structp png_ptr)
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.2.53beta02 - February 5, 2015" PNG_STRING_NEWLINE \
"libpng version 1.2.53beta02 - February 6, 2015" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.2.53beta02 - February 5, 2015\
return ((png_charp) "libpng version 1.2.53beta02 - February 6, 2015\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -57,10 +57,10 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
png_uint_32 i = png_get_uint_32(buf);
#else
/* Avoid an extra function call by inlining the result. */
png_uint_32 i = ((png_uint_32)(*buf) << 24) +
((png_uint_32)(*(buf + 1)) << 16) +
((png_uint_32)(*(buf + 2)) << 8) +
((png_uint_32)(*(buf + 3)) );
png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) +
((png_uint_32)((*(buf + 1)) & 0xff) << 16) +
((png_uint_32)((*(buf + 2)) & 0xff) << 8) +
((png_uint_32)((*(buf + 3)) & 0xff) );
#endif
if (i > PNG_UINT_31_MAX)
png_error(png_ptr, "PNG unsigned integer out of range.");
@ -71,10 +71,10 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
png_uint_32 PNGAPI
png_get_uint_32(png_bytep buf)
{
png_uint_32 i = ((png_uint_32)(*buf) << 24) +
((png_uint_32)(*(buf + 1)) << 16) +
((png_uint_32)(*(buf + 2)) << 8) +
(png_uint_32)(*(buf + 3));
png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) +
((png_uint_32)((*(buf + 1)) & 0xff) << 16) +
((png_uint_32)((*(buf + 2)) & 0xff) << 8) +
((png_uint_32)((*(buf + 3)) & 0xff) );
return (i);
}
@ -86,10 +86,10 @@ png_get_uint_32(png_bytep buf)
png_int_32 PNGAPI
png_get_int_32(png_bytep buf)
{
png_int_32 i = ((png_int_32)(*buf) << 24) +
((png_int_32)(*(buf + 1)) << 16) +
((png_int_32)(*(buf + 2)) << 8) +
(png_int_32)(*(buf + 3));
png_int_32 i = ((png_int_32)((*(buf )) & 0xff) << 24) +
((png_int_32)((*(buf + 1)) & 0xff) << 16) +
((png_int_32)((*(buf + 2)) & 0xff) << 8) +
((png_int_32)((*(buf + 3)) & 0xff) );
return (i);
}
@ -98,8 +98,8 @@ png_get_int_32(png_bytep buf)
png_uint_16 PNGAPI
png_get_uint_16(png_bytep buf)
{
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
(png_uint_16)(*(buf + 1)));
png_uint_16 i = ((png_uint_16)((*(buf )) & 0xff) << 8) +
((png_uint_16)((*(buf + 1)) & 0xff) );
return (i);
}

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.2.53 [%RDATE%]
* Last changed in libpng 1.2.53 [February 6, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)