From 866fdf6f8f52e58f7e5325f1c724bb72f41eae40 Mon Sep 17 00:00:00 2001 From: Adam Richter Date: Sun, 30 Aug 2020 14:06:01 -0700 Subject: [PATCH] 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 Signed-off-by: Cosmin Truta --- AUTHORS | 1 + pngtrans.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 66d9201c2..c98d52286 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ PNG REFERENCE LIBRARY AUTHORS This is the list of PNG Reference Library ("libpng") Contributing Authors, for copyright and licensing purposes. + * Adam Richter * Andreas Dilger * Cosmin Truta * Dave Martindale diff --git a/pngtrans.c b/pngtrans.c index 1100f46eb..709345132 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -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. */ 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) {