[libpng16] Make png_check_chunk_length|name() parameters const

This commit is contained in:
Glenn Randers-Pehrson 2017-08-05 15:33:24 -05:00
parent fcd1bb9312
commit 13bc0b6b1f
3 changed files with 9 additions and 9 deletions

View File

@ -170,7 +170,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int keep; /* unknown handling method */ int keep; /* unknown handling method */
#endif #endif
png_alloc_size_t limit = PNG_UINT_31_MAX;
/* First we make sure we have enough data for the 4-byte chunk name /* First we make sure we have enough data for the 4-byte chunk name
* and the 4-byte chunk length before proceeding with decoding the * and the 4-byte chunk length before proceeding with decoding the

View File

@ -1527,11 +1527,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif #endif
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
png_uint_32 chunk_name),PNG_EMPTY); const png_uint_32 chunk_name),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
png_uint_32 chunk_length),PNG_EMPTY); const png_uint_32 chunk_length),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);

View File

@ -3087,25 +3087,26 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name) png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name)
{ {
int i; int i;
png_uint_32 cn=chunk_name;
png_debug(1, "in png_check_chunk_name"); png_debug(1, "in png_check_chunk_name");
for (i=1; i<=4; ++i) for (i=1; i<=4; ++i)
{ {
int c = chunk_name & 0xff; int c = cn & 0xff;
if (c < 65 || c > 122 || (c > 90 && c < 97)) if (c < 65 || c > 122 || (c > 90 && c < 97))
png_chunk_error(png_ptr, "invalid chunk type"); png_chunk_error(png_ptr, "invalid chunk type");
chunk_name >>= 8; cn >>= 8;
} }
} }
void /* PRIVATE */ void /* PRIVATE */
png_check_chunk_length(png_structrp png_ptr, png_uint_32 length) png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
{ {
png_alloc_size_t limit = PNG_UINT_31_MAX; png_alloc_size_t limit = PNG_UINT_31_MAX;