Coverity bug fix: dead code

Also fix the previous fix attempt; the intent was to limit the calls to crc32 to
ZLIB_IO_MAX, although it is not clear that this is optimal.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler 2015-09-19 16:19:18 -07:00
parent 714515bc0c
commit 3e46c31961

10
png.c
View File

@ -140,11 +140,17 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
do
{
uInt safe_length = (uInt)length;
uInt safe_length;
if (safe_length == 0)
/* TODO: this uses ZLIB_IO_MAX which may be #defined to less than the
* maximum of a uInt, is this the best thing to do?
*/
if (length > ZLIB_IO_MAX)
safe_length = ZLIB_IO_MAX;
else
safe_length = (uInt)/*SAFE*/length;
crc = crc32(crc, ptr, safe_length);
/* The following should never issue compiler warnings; if they do the