Set png_ptr->old_prev_row_size=0 to force prev_row to be cleared

This commit is contained in:
Glenn Randers-Pehrson 2009-05-16 08:47:20 -05:00
parent ba05bddf92
commit f4276c36c9
4 changed files with 15 additions and 8 deletions

View File

@ -54,6 +54,8 @@ version 1.2.37beta01 [May 14, 2009]
version 1.2.37beta02 [May 16, 2009] version 1.2.37beta02 [May 16, 2009]
Fixed typo in libpng documentation (FILTER_AVE should be FILTER_AVG) Fixed typo in libpng documentation (FILTER_AVE should be FILTER_AVG)
Relocated misplaced #endif in pngwrite.c, sCAL chunk handler. Relocated misplaced #endif in pngwrite.c, sCAL chunk handler.
In pngpread.c and pngrutil.c, set png_ptr->old_prev_row_size=0 to
force the prev_row array to be cleared before row 0 of each pass.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2379,6 +2379,8 @@ version 1.2.37beta01 [May 14, 2009]
version 1.2.37beta02 [May 16, 2009] version 1.2.37beta02 [May 16, 2009]
Fixed typo in libpng documentation (FILTER_AVE should be FILTER_AVG) Fixed typo in libpng documentation (FILTER_AVE should be FILTER_AVG)
Relocated misplaced #endif in pngwrite.c, sCAL chunk handler. Relocated misplaced #endif in pngwrite.c, sCAL chunk handler.
In pngpread.c and pngrutil.c, set png_ptr->old_prev_row_size=0 to
force the prev_row array to be cleared before row 0 of each pass.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -1,9 +1,9 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.2.32 [September 18, 2008] * Last changed in libpng 1.2.37 [May 16, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@ -1013,11 +1013,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 clearing prev_row */
#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_check(png_ptr, png_ptr->prev_row, 0,
png_ptr->rowbytes + 1);
do do
{ {
png_ptr->pass++; png_ptr->pass++;
@ -1049,6 +1050,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

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.2.37 [May 15, 2009] * Last changed in libpng 1.2.37 [May 16, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -2913,12 +2913,13 @@ 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;
/* Force prev_row to be cleared. */
png_ptr->old_prev_row_size=0;
#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_check(png_ptr, png_ptr->prev_row, 0,
png_ptr->rowbytes + 1);
do do
{ {
png_ptr->pass++; png_ptr->pass++;
@ -3187,7 +3188,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (row_bytes + 64 > png_ptr->old_big_row_buf_size) if (row_bytes + 64 > png_ptr->old_big_row_buf_size)
{ {
png_free(png_ptr, png_ptr->big_row_buf); png_free(png_ptr, png_ptr->big_row_buf);
png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64); png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64);
if (png_ptr->interlaced) if (png_ptr->interlaced)
png_memset(png_ptr->big_row_buf, 0, row_bytes + 64); png_memset(png_ptr->big_row_buf, 0, row_bytes + 64);
png_ptr->row_buf = png_ptr->big_row_buf + 32; png_ptr->row_buf = png_ptr->big_row_buf + 32;