Fix an off-by-one error in png_do_check_palette_indexes

The last byte of each row was ignored in a function that was executed
under the build flags `PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED` and
`PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED`.

This is a revert of a change previously applied in libpng-1.6.33beta01.
See SourceForge bug #269 at https://sourceforge.net/p/libpng/bugs/269/

Reviewed-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
Adam Richter 2020-08-30 14:06:01 -07:00 committed by Cosmin Truta
parent 6f8257e437
commit 866fdf6f8f
2 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ PNG REFERENCE LIBRARY AUTHORS
This is the list of PNG Reference Library ("libpng") Contributing This is the list of PNG Reference Library ("libpng") Contributing
Authors, for copyright and licensing purposes. Authors, for copyright and licensing purposes.
* Adam Richter
* Andreas Dilger * Andreas Dilger
* Cosmin Truta * Cosmin Truta
* Dave Martindale * Dave Martindale

View File

@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* forms produced on either GCC or MSVC. * forms produced on either GCC or MSVC.
*/ */
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1; png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth) switch (row_info->bit_depth)
{ {