Fix first row init on read.

The code failed to zero out the row buffer at the start of a pass where the AVG
filter is used because 'row_number' is not always zero (on interlaced images)
and, apparently, the assertion that the buffer had been zeroed when allocated
was not always correct for non-interlaced images.  Revealed by pngvalid --size
with a hack to make it always use AVG.

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2015-11-24 17:56:06 -08:00
parent 5357dd77f0
commit 85d7eca204
2 changed files with 4 additions and 15 deletions

View File

@@ -2284,18 +2284,10 @@ png_write_filter_row(png_structrp png_ptr, png_bytep prev_pixels,
filters_to_try |= PNG_FILTER_SUB/*equialent to PAETH here*/;
}
#if 0
/* If this leaves the AVG filter it will be used on the first row
* this is handled in the filter implementation by setting prev_row
* to NULL below.
*/
#else /* DOESN'T WORK (problems in the read code?) */
if ((filters_to_try & PNG_FILTER_AVG) != 0U)
{
filters_to_try &= PNG_BIC_MASK(PNG_FILTER_AVG);
filters_to_try |= PNG_FILTER_NONE;
}
#endif
}
/* Check for a narrow image; the blocking will never return just one