diff --git a/ANNOUNCE b/ANNOUNCE index 0c4f18306..99d4d8bbb 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.11rc04 - June 4, 2012 +Libpng 1.5.11rc04 - June 6, 2012 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. @@ -54,7 +54,8 @@ Version 1.5.11rc03 [June 4, 2012] performs an optimization which is safe; however it then warns about it. Changing the type of 'palette_number' in pngvalid.c removes the warning. -Version 1.5.11rc04 [June 4, 2012] +Version 1.5.11rc04 [June 6, 2012] + Improved efficiency of new do_check_palette_indexes() function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 721538993..80a6766f5 100644 --- a/CHANGES +++ b/CHANGES @@ -3882,7 +3882,8 @@ Version 1.5.11rc03 [June 4, 2012] performs an optimization which is safe; however it then warns about it. Changing the type of 'palette_number' in pngvalid.c removes the warning. -Version 1.5.11rc04 [June 4, 2012] +Version 1.5.11rc04 [June 6, 2012] + Improved performance of new do_check_palette_indexes() function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngrtran.c b/pngrtran.c index 556185286..906cb52f1 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -2301,7 +2301,8 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info) #ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Added at libpng-1.5.10 */ - if (row_info->color_type == PNG_COLOR_TYPE_PALETTE) + if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= 0) png_do_check_palette_indexes(png_ptr, row_info); #endif diff --git a/pngtrans.c b/pngtrans.c index fef12f185..44e8bc6d8 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info) { for (; rp > png_ptr->row_buf; rp--) { - if (*rp >= png_ptr->num_palette_max) + if (*rp > png_ptr->num_palette_max) png_ptr->num_palette_max = (int) *rp; } diff --git a/pngwrite.c b/pngwrite.c index b587f1b99..d0567d84e 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -806,7 +806,8 @@ png_write_row(png_structp png_ptr, png_const_bytep row) /* Added at libpng-1.5.10 */ #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Check for out-of-range palette index */ - if(row_info.color_type == PNG_COLOR_TYPE_PALETTE) + if (row_info.color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= 0) png_do_check_palette_indexes(png_ptr, &row_info); #endif