Set png_ptr->old_prev_row_size=0 in pngpread.c and pngrutil.c

This forces the prev_row array to be cleared before the first
row of each image and interlace pass.
This commit is contained in:
Glenn Randers-Pehrson 2009-05-16 07:32:28 -05:00
parent 7654682c25
commit ee59a9f9f0
2 changed files with 6 additions and 3 deletions

View File

@ -1110,11 +1110,12 @@ png_read_push_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
png_ptr->old_prev_row_size = 0; /* Force prev_row to be cleared */
#if defined(PNG_READ_INTERLACING_SUPPORTED)
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
do do
{ {
png_ptr->pass++; png_ptr->pass++;
@ -1147,6 +1148,7 @@ png_read_push_finish_row(png_structp png_ptr)
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
} }
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)

View File

@ -2992,11 +2992,12 @@ png_read_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
png_ptr->old_prev_row_size = 0; /* Force prev_row to be cleared */
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
do do
{ {
png_ptr->pass++; png_ptr->pass++;