mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user