diff --git a/ANNOUNCE b/ANNOUNCE index 984783893..515718b7e 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta08 - April 17, 2013 +Libpng 1.7.0beta08 - April 18, 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. @@ -249,7 +249,7 @@ Version 1.7.0beta07 [April 14, 2013] (Flavio Medeiros). Corrected length written to uncompressed iTXt chunks (Samuli Suominen). -Version 1.7.0beta08 [April 17, 2013] +Version 1.7.0beta08 [April 18, 2013] Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length written by libpng-1.6.0 and 1.6.1. diff --git a/CHANGES b/CHANGES index 32e851867..ddaf00ad0 100644 --- a/CHANGES +++ b/CHANGES @@ -4536,9 +4536,10 @@ Version 1.7.0beta07 [April 14, 2013] (Flavio Medeiros). Corrected length written to uncompressed iTXt chunks (Samuli Suominen). -Version 1.7.0beta08 [April 17, 2013] +Version 1.7.0beta08 [April 18, 2013] Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length written by libpng-1.6.0 and 1.6.1. + Disallow storing sRGB information when the sRGB is not supported. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/LICENSE b/LICENSE index 2de0beeb9..d535662de 100644 --- a/LICENSE +++ b/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 14, 2013, are +libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 18, 2013, are Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -108,4 +108,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -April 14, 2013 +April 18, 2013 diff --git a/README b/README index 300e1aee0..7602a3672 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.7.0beta08 - April 14, 2013 (shared library 17.0) +README for libpng version 1.7.0beta08 - April 18, 2013 (shared library 17.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. diff --git a/contrib/libtests/pngunknown.c b/contrib/libtests/pngunknown.c index 464f52677..288307d9d 100644 --- a/contrib/libtests/pngunknown.c +++ b/contrib/libtests/pngunknown.c @@ -139,23 +139,128 @@ static struct { "PLTE", PNG_INFO_PLTE, png_PLTE, 0, 0, ABSENT, 0 }, /* Non-critical chunks that libpng handles */ - { "bKGD", PNG_INFO_bKGD, png_bKGD, 0, 1, START, 0 }, - { "cHRM", PNG_INFO_cHRM, png_cHRM, 0, 1, START, 0 }, - { "gAMA", PNG_INFO_gAMA, png_gAMA, 0, 1, START, 0 }, - { "hIST", PNG_INFO_hIST, png_hIST, 0, 1, ABSENT, 0 }, - { "iCCP", PNG_INFO_iCCP, png_iCCP, 0, 1, ABSENT, 0 }, - { "iTXt", PNG_INFO_iTXt, png_iTXt, 0, 1, ABSENT, 0 }, - { "oFFs", PNG_INFO_oFFs, png_oFFs, 0, 1, START, 0 }, - { "pCAL", PNG_INFO_pCAL, png_pCAL, 0, 1, START, 0 }, - { "pHYs", PNG_INFO_pHYs, png_pHYs, 0, 1, START, 0 }, - { "sBIT", PNG_INFO_sBIT, png_sBIT, 0, 1, START, 0 }, - { "sCAL", PNG_INFO_sCAL, png_sCAL, 0, 1, START, 0 }, - { "sPLT", PNG_INFO_sPLT, png_sPLT, 0, 1, ABSENT, 0 }, - { "sRGB", PNG_INFO_sRGB, png_sRGB, 0, 1, START, 0 }, - { "tEXt", PNG_INFO_tEXt, png_tEXt, 0, 1, START, 0 }, - { "tIME", PNG_INFO_tIME, png_tIME, 0, 1, START, 0 }, - { "tRNS", PNG_INFO_tRNS, png_tRNS, 0, 0, ABSENT, 0 }, - { "zTXt", PNG_INFO_zTXt, png_zTXt, 0, 1, END, 0 }, + /* This is a mess but it seems to be the only way to do it - there is no way to + * check for definition outside a #if. + */ + { "bKGD", PNG_INFO_bKGD, png_bKGD, +# ifdef PNG_READ_bKGD_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "cHRM", PNG_INFO_cHRM, png_cHRM, +# ifdef PNG_READ_cHRM_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "gAMA", PNG_INFO_gAMA, png_gAMA, +# ifdef PNG_READ_gAMA_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "hIST", PNG_INFO_hIST, png_hIST, +# ifdef PNG_READ_hIST_SUPPORTED + 0, +# else + 1, +# endif + 1, ABSENT, 0 }, + { "iCCP", PNG_INFO_iCCP, png_iCCP, +# ifdef PNG_READ_iCCP_SUPPORTED + 0, +# else + 1, +# endif + 1, ABSENT, 0 }, + { "iTXt", PNG_INFO_iTXt, png_iTXt, +# ifdef PNG_READ_iTXt_SUPPORTED + 0, +# else + 1, +# endif + 1, ABSENT, 0 }, + { "oFFs", PNG_INFO_oFFs, png_oFFs, +# ifdef PNG_READ_oFFs_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "pCAL", PNG_INFO_pCAL, png_pCAL, +# ifdef PNG_READ_pCAL_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "pHYs", PNG_INFO_pHYs, png_pHYs, +# ifdef PNG_READ_pHYs_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "sBIT", PNG_INFO_sBIT, png_sBIT, +# ifdef PNG_READ_sBIT_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "sCAL", PNG_INFO_sCAL, png_sCAL, +# ifdef PNG_READ_sCAL_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "sPLT", PNG_INFO_sPLT, png_sPLT, +# ifdef PNG_READ_sPLT_SUPPORTED + 0, +# else + 1, +# endif + 1, ABSENT, 0 }, + { "sRGB", PNG_INFO_sRGB, png_sRGB, +# ifdef PNG_READ_sRGB_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "tEXt", PNG_INFO_tEXt, png_tEXt, +# ifdef PNG_READ_tEXt_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "tIME", PNG_INFO_tIME, png_tIME, +# ifdef PNG_READ_tIME_SUPPORTED + 0, +# else + 1, +# endif + 1, START, 0 }, + { "tRNS", PNG_INFO_tRNS, png_tRNS, +# ifdef PNG_READ_tRNS_SUPPORTED + 0, +# else + 1, +# endif + 0, ABSENT, 0 }, + { "zTXt", PNG_INFO_zTXt, png_zTXt, +# ifdef PNG_READ_zTXt_SUPPORTED + 0, +# else + 1, +# endif + 1, END, 0 }, /* No libpng handling */ { "sTER", PNG_INFO_sTER, png_sTER, 1, 1, START, 0 }, @@ -955,6 +1060,7 @@ main(void) { fprintf(stderr, " test ignored because libpng was not built with unknown chunk support\n"); - return 0; + /* So the test is skipped: */ + return 77; } #endif diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index 42762e2d5..87487da7e 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -10351,6 +10351,7 @@ int main(int argc, char **argv) int main(void) { fprintf(stderr, "pngvalid: no write support in libpng, all tests skipped\n"); - return 0; + /* So the test is skipped: */ + return 77; } #endif diff --git a/contrib/tools/fixitxt.c b/contrib/tools/fixitxt.c index b979a7a30..d717b3e6a 100644 --- a/contrib/tools/fixitxt.c +++ b/contrib/tools/fixitxt.c @@ -25,13 +25,15 @@ * gcc -O -o fixitxt fixitxt.c -lz */ +#define MAX_LENGTH 500000 + #define GETBREAK c=getchar(); if (c == EOF) break; #include main() { unsigned int i; - unsigned char buf[100000]; + unsigned char buf[MAX_LENGTH]; unsigned long crc; unsigned int c; @@ -46,13 +48,13 @@ if (c != EOF) for (;;) { /* Read the length */ - unsigned int length; + unsigned long length; c=GETBREAK; buf[0] = c; c=GETBREAK; buf[1] = c; c=GETBREAK; buf[2] = c; c=GETBREAK; buf[3] = c; - length=buf[0]<<24 | buf[1]<<16 | buf[2] << 8 | buf[3]; + length=((((unsigned long) buf[0]<<8 + buf[1]<<16) + buf[2] << 8) + buf[3]); /* Read the chunkname */ c=GETBREAK; buf[4] = c; c=GETBREAK; buf[5] = c; @@ -63,6 +65,9 @@ for (;;) /* The iTXt chunk type expressed as integers is (105, 84, 88, 116) */ if (buf[4] == 105 && buf[5] == 84 && buf[6] == 88 && buf[7] == 116) { + if (length >= MAX_LENGTH-12) + break; /* To do: handle this more gracefully */ + /* Initialize the CRC */ crc = crc32(0, Z_NULL, 0); @@ -86,6 +91,9 @@ for (;;) length++; + if (length >= MAX_LENGTH-12) + break; + c=GETBREAK; buf[length+11]=c; @@ -115,12 +123,8 @@ for (;;) { c=GETBREAK; putchar(c); - buf[i]=c; } - crc = crc32(0, Z_NULL, 0); - crc = crc32(crc, buf+4, (uInt)length+4); - if (c == EOF) { break; diff --git a/libpng-manual.txt b/libpng-manual.txt index 24e525a0f..532211ac9 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.7.0beta08 - April 14, 2013 + libpng version 1.7.0beta08 - April 18, 2013 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.7.0beta08 - April 14, 2013 + libpng versions 0.97, January 1998, through 1.7.0beta08 - April 18, 2013 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -5196,7 +5196,7 @@ Other rules can be inferred by inspecting the libpng source. XVII. Y2K Compliance in libpng -April 14, 2013 +April 18, 2013 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index 7e22a8873..28fb5c306 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "April 14, 2013" +.TH LIBPNG 3 "April 18, 2013" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta08 .SH SYNOPSIS @@ -494,7 +494,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.7.0beta08 - April 14, 2013 + libpng version 1.7.0beta08 - April 18, 2013 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -505,7 +505,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.7.0beta08 - April 14, 2013 + libpng versions 0.97, January 1998, through 1.7.0beta08 - April 18, 2013 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -5691,7 +5691,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XVII. Y2K Compliance in libpng -April 14, 2013 +April 18, 2013 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -5961,7 +5961,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.7.0beta08 - April 14, 2013: +Libpng version 1.7.0beta08 - April 18, 2013: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -5984,7 +5984,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 14, 2013, are +libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 18, 2013, are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -6083,7 +6083,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -April 14, 2013 +April 18, 2013 .\" end of man page diff --git a/libpngpf.3 b/libpngpf.3 index 3914691e0..3892b652c 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,4 +1,4 @@ -.TH LIBPNGPF 3 "April 14, 2013" +.TH LIBPNGPF 3 "April 18, 2013" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta08 (private functions) diff --git a/png.5 b/png.5 index 3f1979779..719cb94ca 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "April 14, 2013" +.TH PNG 5 "April 18, 2013" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index dac30e590..6e68237a9 100644 --- a/png.c +++ b/png.c @@ -691,13 +691,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.7.0beta08 - April 14, 2013" PNG_STRING_NEWLINE \ + "libpng version 1.7.0beta08 - April 18, 2013" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.7.0beta08 - April 14, 2013\ + return "libpng version 1.7.0beta08 - April 18, 2013\ Copyright (c) 1998-2013 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2183,7 +2183,10 @@ png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace, png_icc_check_tag_table(png_ptr, colorspace, name, profile_length, profile)) { - png_icc_set_sRGB(png_ptr, colorspace, profile, 0); +# ifdef PNG_sRGB_SUPPORTED + /* If no sRGB support, don't try storing sRGB information */ + png_icc_set_sRGB(png_ptr, colorspace, profile, 0); +# endif return 1; } diff --git a/png.h b/png.h index 2676b8255..882f1e42f 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.7.0beta08 - April 14, 2013 + * libpng version 1.7.0beta08 - April 18, 2013 * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.7.0beta08 - April 14, 2013: Glenn + * libpng versions 0.97, January 1998, through 1.7.0beta08 - April 18, 2013: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -200,7 +200,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 14, 2013, are + * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta08, April 18, 2013, are * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -312,7 +312,7 @@ * Y2K compliance in libpng: * ========================= * - * April 14, 2013 + * April 18, 2013 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -380,7 +380,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.7.0beta08" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.7.0beta08 - April 14, 2013\n" + " libpng version 1.7.0beta08 - April 18, 2013\n" #define PNG_LIBPNG_VER_SONUM 17 #define PNG_LIBPNG_VER_DLLNUM 17 diff --git a/pngconf.h b/pngconf.h index f60372bf8..04a704d28 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.7.0beta08 - April 14, 2013 + * libpng version 1.7.0beta08 - April 18, 2013 * * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngrtran.c b/pngrtran.c index 6d3fc6016..bf439f392 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -227,6 +227,8 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma, */ # ifdef PNG_READ_sRGB_SUPPORTED png_ptr->flags |= PNG_FLAG_ASSUME_sRGB; +# else + PNG_UNUSED(png_ptr) # endif if (is_screen) output_gamma = PNG_GAMMA_sRGB; diff --git a/pngtest.c b/pngtest.c index 1ce5c944e..5a8372f2d 100644 --- a/pngtest.c +++ b/pngtest.c @@ -43,7 +43,23 @@ #include "png.h" -#ifdef PNG_READ_SUPPORTED /* else nothing can be done */ +/* Known chunks that exist in pngtest.png must be supported or pngtest will fail + * simply as a result of re-ordering them. This may be fixed in 1.7 + */ +#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\ + defined PNG_READ_bKGD_SUPPORTED &&\ + defined PNG_READ_cHRM_SUPPORTED &&\ + defined PNG_READ_gAMA_SUPPORTED &&\ + defined PNG_READ_oFFs_SUPPORTED &&\ + defined PNG_READ_pCAL_SUPPORTED &&\ + defined PNG_READ_pHYs_SUPPORTED &&\ + defined PNG_READ_sBIT_SUPPORTED &&\ + defined PNG_READ_sCAL_SUPPORTED &&\ + defined PNG_READ_sRGB_SUPPORTED &&\ + defined PNG_READ_tEXt_SUPPORTED &&\ + defined PNG_READ_tIME_SUPPORTED &&\ + defined PNG_READ_zTXt_SUPPORTED + #include PNG_ZLIB_HEADER /* defined by pnglibconf.h */ /* Copied from pngpriv.h but only used in error messages below. */ #ifndef PNG_ZBUF_SIZE @@ -1942,7 +1958,8 @@ main(void) { fprintf(STDERR, " test ignored because libpng was not built with read support\n"); - return 0; + /* And skip this test */ + return 77; } #endif diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt index c6c14d6ac..68a320498 100644 --- a/projects/vstudio/readme.txt +++ b/projects/vstudio/readme.txt @@ -1,7 +1,7 @@ VisualStudio instructions -libpng version 1.7.0beta08 - April 14, 2013 +libpng version 1.7.0beta08 - April 18, 2013 Copyright (c) 1998-2010 Glenn Randers-Pehrson diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props index 14bc741be..0a4226d41 100644 --- a/projects/vstudio/zlib.props +++ b/projects/vstudio/zlib.props @@ -2,7 +2,7 @@