From ad1a4c8cc3eadeae168d492083f3087c7ad7621c Mon Sep 17 00:00:00 2001 From: John Bowler Date: Fri, 27 Dec 2013 07:53:50 -0600 Subject: [PATCH] [libpng17] Added libpng 1.5 checks to pngvalid.c --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- contrib/libtests/pngvalid.c | 17 ++++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 8105a9632..255db002b 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta26 - December 26, 2013 +Libpng 1.7.0beta26 - December 27, 2013 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -468,7 +468,8 @@ Version 1.7.0beta25 [December 26, 2013] Merged files with version 1.6.8 that have not changed since then. Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69 -Version 1.7.0beta26 [December 26, 2013] +Version 1.7.0beta26 [December 27, 2013] + Added libpng 1.5 checks to pngvalid.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 5bea7d922..6eed715c3 100644 --- a/CHANGES +++ b/CHANGES @@ -4757,7 +4757,8 @@ Version 1.7.0beta25 [December 26, 2013] Merged files with version 1.6.8 that have not changed since then. Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69 -Version 1.7.0beta26 [December 26, 2013] +Version 1.7.0beta26 [December 27, 2013] + Added libpng 1.5 checks to pngvalid.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index 1fbaafc9c..b39c01cf3 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -4867,7 +4867,7 @@ standard_check_text(png_const_structp pp, png_const_textp tp, static void standard_text_validate(standard_display *dp, png_const_structp pp, - png_infop pi) + png_infop pi, int check_end) { png_textp tp = NULL; png_uint_32 num_text = png_get_text(pp, pi, &tp, NULL); @@ -4875,7 +4875,13 @@ standard_text_validate(standard_display *dp, png_const_structp pp, if (num_text == 2 && tp != NULL) { standard_check_text(pp, tp, "image name", dp->ps->current->name); - standard_check_text(pp, tp+1, "end marker", "end"); + + /* This exists because prior to 1.6 the progressive reader left the + * png_struct z_stream unreset at the end of the image, so subsequent + * attempts to use it simply returns Z_STREAM_END. + */ + if (check_end) + standard_check_text(pp, tp+1, "end marker", "end"); } else @@ -4888,7 +4894,7 @@ standard_text_validate(standard_display *dp, png_const_structp pp, } } #else -# define standard_text_validate(dp,pp,pi) ((void)0) +# define standard_text_validate(dp,pp,pi,check_end) ((void)0) #endif static void @@ -4978,7 +4984,8 @@ standard_end(png_structp ppIn, png_infop pi) /* Validate the image - progressive reading only produces one variant for * interlaced images. */ - standard_text_validate(dp, pp, pi); + standard_text_validate(dp, pp, pi, + PNG_LIBPNG_VER >= 10600/*check_end: see comments above*/); standard_image_validate(dp, pp, 0, -1); } @@ -5049,7 +5056,7 @@ standard_test(png_store* PNG_CONST psIn, png_uint_32 PNG_CONST id, */ if (!d.speed) { - standard_text_validate(&d, pp, pi); + standard_text_validate(&d, pp, pi, 1/*check_end*/); standard_image_validate(&d, pp, 0, 1); } else