From 1088f4925f259faa74606b892fbfbd126a68f23e Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 30 May 2015 22:58:54 -0500 Subject: [PATCH] [libpng16] Fixed old cut&paste bug in the weighted filter selection code in pngwutil.c, introduced in libpng-0.95, March 1997. --- ANNOUNCE | 2 ++ CHANGES | 2 ++ pngwutil.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index fdb90c069..06381d725 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -59,6 +59,8 @@ Version 1.6.18beta05 [May 31, 2015] sub_row, up_row, avg_row, and paeth_row into try_row and tst_row. Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c to avoid confusion with the libpng private macros. + Fixed old cut&paste bug in the weighted filter selection code in + pngwutil.c, introduced in libpng-0.95, March 1997. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 14cdf1661..84e311e9a 100644 --- a/CHANGES +++ b/CHANGES @@ -5244,6 +5244,8 @@ Version 1.6.18beta05 [May 31, 2015] sub_row, up_row, avg_row, and paeth_row into try_row and tst_row. Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c to avoid confusion with the libpng private macros. + Fixed old cut&paste bug in the weighted filter selection code in + pngwutil.c, introduced in libpng-0.95, March 1997. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngwutil.c b/pngwutil.c index d83e37f51..66e5fcfdd 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.17 [March 26, 2015] + * Last changed in libpng 1.6.18 [(PENDING RELEASE)] * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -2814,7 +2814,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info) for (j = 0; j < num_p_filters; j++) { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG) { sumlo = (sumlo * png_ptr->filter_weights[j]) >> PNG_WEIGHT_SHIFT;