diff --git a/ANNOUNCE b/ANNOUNCE index 7386894cf..abc870d72 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -299,6 +299,7 @@ Version 1.6.0beta17 [March 10, 2012] header. Version 1.6.0beta18 [March 10, 2012] + Issue a png_benign_error() instead of png_warning() about bad palette index. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index ae1d58c60..2fe5123d7 100644 --- a/CHANGES +++ b/CHANGES @@ -4050,6 +4050,7 @@ Version 1.6.0beta17 [March 10, 2012] header. Version 1.6.0beta18 [March 10, 2012] + Issue a png_benign_error() instead of png_warning() about bad palette index. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-manual.txt b/libpng-manual.txt index ff13702c5..b7832e3e8 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -4521,7 +4521,8 @@ From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the function) incorrectly returned a value of type png_uint_32. Checking for invalid palette index on read or write was added at libpng -1.5.10. This is enabled by default but can be disabled in each png_ptr with +1.5.10. When an invalid index is found, libpng issues a benign error. +This is enabled by default but can be disabled in each png_ptr with png_set_check_for_invalid_index(png_ptr, allowed); diff --git a/libpng.3 b/libpng.3 index 489a12d01..6aa3def28 100644 --- a/libpng.3 +++ b/libpng.3 @@ -5529,7 +5529,8 @@ From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the function) incorrectly returned a value of type png_uint_32. Checking for invalid palette index on read or write was added at libpng -1.5.10. This is enabled by default but can be disabled in each png_ptr with +1.5.10. When an invalid index is found, libpng issues a benign error. +This is enabled by default but can be disabled in each png_ptr with png_set_check_for_invalid_index(png_ptr, allowed); diff --git a/pngread.c b/pngread.c index 68304b8b4..36e02d5ee 100644 --- a/pngread.c +++ b/pngread.c @@ -669,7 +669,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) /* Report invalid palette index; added at libng-1.5.10 */ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_palette_max > png_ptr->num_palette) - png_warning(png_ptr, "Read palette index exceeding num_palette"); + png_benign_error(png_ptr, "Read palette index exceeding num_palette"); #endif do diff --git a/pngset.c b/pngset.c index 882be9718..07b78c4fa 100644 --- a/pngset.c +++ b/pngset.c @@ -1343,7 +1343,7 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed) { png_debug(1, "in png_set_check_for_invalid_index"); - if (allowed) + if (allowed > 0) png_ptr->num_palette_max = 0; else diff --git a/pngwrite.c b/pngwrite.c index 4b10b0417..7f213c9a6 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -310,7 +310,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED if (png_ptr->num_palette_max > png_ptr->num_palette) - png_warning(png_ptr, "Wrote palette index exceeding num_palette"); + png_benign_error(png_ptr, "Wrote palette index exceeding num_palette"); #endif /* See if user wants us to write information chunks */