[libpng17] Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler

(Bug report by Viktor Szaka'ts).
This commit is contained in:
Glenn Randers-Pehrson 2015-04-04 08:45:34 -05:00
parent 673ae608ab
commit 7a35bcac1a
8 changed files with 25 additions and 13 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.7.0beta59 - March 31, 2015
Libpng 1.7.0beta59 - April 4, 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.
@ -779,7 +779,7 @@ Version 1.7.0beta58 [March 25, 2015]
condition on RELEASE (or not) builds and tidy up the #ifdef handling of
functions.
Version 1.7.0beta59 [March 31, 2015]
Version 1.7.0beta59 [April 4, 2015]
Transformed rewrite: changed row_info, added checks. This introduces an
internal struct (png_transform_control) to replace row_info and uses
that to implement affirms correctly. The change also adds checks on
@ -789,7 +789,11 @@ Version 1.7.0beta59 [March 31, 2015]
review of previous checks, removal of some where SAFE. pngvalid: add
testing of tRNS for better code coverage pngvalid: correct rgb-to-gray
error calculations. Code coverage is still incomplete: see /*UNTESTED*/
in pngrtran.c
in pngrtran.c. This fixes some arithmetic errors that caused some tests
to fail on some 32-bit platforms (Bug reports by Peter Breitenlohner [i686]
and Petr Gajdos [i586]).
Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
(Bug report by Viktor Szaka'ts).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -5069,7 +5069,7 @@ Version 1.7.0beta58 [March 25, 2015]
condition on RELEASE (or not) builds and tidy up the #ifdef handling of
functions.
Version 1.7.0beta59 [March 31, 2015]
Version 1.7.0beta59 [April 4, 2015]
Transformed rewrite: changed row_info, added checks. This introduces an
internal struct (png_transform_control) to replace row_info and uses
that to implement affirms correctly. The change also adds checks on
@ -5079,7 +5079,11 @@ Version 1.7.0beta59 [March 31, 2015]
review of previous checks, removal of some where SAFE. pngvalid: add
testing of tRNS for better code coverage pngvalid: correct rgb-to-gray
error calculations. Code coverage is still incomplete: see /*UNTESTED*/
in pngrtran.c
in pngrtran.c. This fixes some arithmetic errors that caused some tests
to fail on some 32-bit platforms (Bug reports by Peter Breitenlohner [i686]
and Petr Gajdos [i586]).
Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
(Bug report by Viktor Szaka'ts).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

6
png.c
View File

@ -689,13 +689,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.7.0beta59 - March 31, 2015" PNG_STRING_NEWLINE \
"libpng version 1.7.0beta59 - April 4, 2015" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2015 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 "libpng version 1.7.0beta59 - March 31, 2015\
return "libpng version 1.7.0beta59 - April 4, 2015\
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2180,7 +2180,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
/* Length *and* intent must match */
if (length == png_sRGB_checks[i].length &&
intent == png_sRGB_checks[i].intent)
intent == (png_uint_32) png_sRGB_checks[i].intent)
{
/* Now calculate the adler32 if not done already. */
if (adler == 0)

View File

@ -78,6 +78,9 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_UNUSED(png_ptr)
#endif
/* Some compilers complain that this is always true. However, it
* can be false when integer overflow happens.
*/
if (size > 0 && size <= PNG_SIZE_MAX
# ifdef PNG_MAX_MALLOC_64K
&& size <= 65536U

View File

@ -584,13 +584,11 @@ png_push_save_buffer(png_structrp png_ptr)
if (png_ptr->save_buffer == NULL)
{
png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_error(png_ptr, "Insufficient memory for save_buffer");
}
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_ptr->save_buffer_max = new_max;
}
if (png_ptr->current_buffer_size)

View File

@ -1803,7 +1803,8 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
return;
}
if (length > png_ptr->num_palette || length > PNG_MAX_PALETTE_LENGTH ||
if (length > png_ptr->num_palette ||
length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
length == 0)
{
png_crc_finish(png_ptr, length);

View File

@ -677,7 +677,6 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
if (new_iccp_profile == NULL)
{
png_free(png_ptr, new_iccp_name);
new_iccp_name = NULL;
png_benign_error(png_ptr,
"Insufficient memory to process iCCP profile");
@ -1562,6 +1561,9 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
}
#ifndef __COVERITY__
/* Some compilers complain that this is always false. However, it
* can be true when integer overflow happens.
*/
if (size > ZLIB_IO_MAX)
{
png_warning(png_ptr,

View File

@ -683,7 +683,7 @@ png_do_check_palette_indexes(png_structrp png_ptr,
*/
for (; rp > png_ptr->row_buf; rp--)
{
if (*rp >> padding != 0)
if ((*rp >> padding) != 0)
png_ptr->num_palette_max = 1;
padding = 0;
}