[libpng17] Treat CRC error handling with png_set_crc_action(), instead of with

png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
This commit is contained in:
Glenn Randers-Pehrson 2014-02-27 15:40:30 -06:00
parent 1345c5bff8
commit 43cd0a0bb5
3 changed files with 14 additions and 19 deletions

View File

@ -566,6 +566,8 @@ Version 1.7.0beta33 [February 27, 2014]
and PNG_USR_CONFIG -> PNG_USER_CONFIG). and PNG_USR_CONFIG -> PNG_USER_CONFIG).
Version 1.7.0beta34 [February 27, 2014] Version 1.7.0beta34 [February 27, 2014]
Treat CRC error handling with png_set_crc_action(), instead of with
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -4855,6 +4855,8 @@ Version 1.7.0beta33 [February 27, 2014]
and PNG_USR_CONFIG -> PNG_USER_CONFIG). and PNG_USR_CONFIG -> PNG_USER_CONFIG).
Version 1.7.0beta34 [February 27, 2014] Version 1.7.0beta34 [February 27, 2014]
Treat CRC error handling with png_set_crc_action(), instead of with
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -59,7 +59,11 @@ png_get_uint_32)(png_const_bytep buf)
return PNG_U32(buf[0], buf[1], buf[2], buf[3]); return PNG_U32(buf[0], buf[1], buf[2], buf[3]);
} }
/* Grab a signed 32-bit integer from a buffer in big-endian format. */ /* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format and there
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
* the following code does a two's complement to native conversion.
*/
png_int_32 (PNGAPI png_int_32 (PNGAPI
png_get_int_32)(png_const_bytep buf) png_get_int_32)(png_const_bytep buf)
{ {
@ -206,10 +210,7 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
} }
else else
{ png_chunk_error(png_ptr, "CRC error");
png_chunk_benign_error(png_ptr, "CRC error");
return (0);
}
return (1); return (1);
} }
@ -293,16 +294,11 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
else if (warn < 2) /* else silent */ else if (warn < 2) /* else silent */
{ {
#ifdef PNG_WARNINGS_SUPPORTED
if (warn) if (warn)
png_chunk_warning(png_ptr, "insufficient memory to read chunk"); png_chunk_warning(png_ptr, "insufficient memory to read chunk");
else else
#endif
{
#ifdef PNG_ERROR_TEXT_SUPPORTED
png_chunk_error(png_ptr, "insufficient memory to read chunk"); png_chunk_error(png_ptr, "insufficient memory to read chunk");
#endif
}
} }
} }
@ -965,15 +961,10 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE))
{ {
if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)
{ return;
png_chunk_benign_error(png_ptr, "CRC error");
}
else else
{ png_chunk_error(png_ptr, "CRC error");
png_chunk_warning(png_ptr, "CRC error");
return;
}
} }
/* Otherwise, we (optionally) emit a warning and use the chunk. */ /* Otherwise, we (optionally) emit a warning and use the chunk. */
@ -2815,7 +2806,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
/* Use the default handling, note that if there is per-chunk /* Use the default handling, note that if there is per-chunk
* handling specified it has already been set into 'keep'. * handling specified it has already been set into 'keep'.
* *
* NOTE: this is an API change in 1.7.0, prior to 1.7.0 libpng * NOTE: this is an API change in 1.7.0. Prior to 1.7.0 libpng
* would force keep to PNG_HANDLE_CHUNK_IF_SAFE at this point, * would force keep to PNG_HANDLE_CHUNK_IF_SAFE at this point,
* and 1.6.0 would issue a warning if this caused a default of * and 1.6.0 would issue a warning if this caused a default of
* discarding the chunk to be changed. * discarding the chunk to be changed.