From e0fea61cd8e7e5d0a5a51ce6723fccfcdceb83e2 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 30 May 2015 22:13:19 -0500 Subject: [PATCH] [libpng17] Imported from libpng-1.7.0beta61.tar --- ANNOUNCE | 11 ++++++++--- CHANGES | 9 +++++++-- LICENSE | 4 ++-- README | 4 ++-- contrib/tools/pngfix.c | 28 ++++++++++++++-------------- libpng-manual.txt | 6 +++--- libpng.3 | 14 +++++++------- libpngpf.3 | 2 +- png.5 | 2 +- png.c | 4 ++-- png.h | 10 +++++----- pngconf.h | 2 +- pngstruct.h | 14 +++++++++++--- pngwutil.c | 2 +- projects/vstudio/readme.txt | 2 +- projects/vstudio/zlib.props | 2 +- scripts/README.txt | 2 +- scripts/pnglibconf.dfa | 6 +++--- scripts/pnglibconf.h.prebuilt | 2 +- 19 files changed, 72 insertions(+), 54 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index ffc81774e..b48e105f0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta61 - May 20, 2015 +Libpng 1.7.0beta61 - May 31, 2015 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. @@ -799,9 +799,14 @@ Version 1.7.0beta60 [May 6, 2015] Replaced "unexpected" with an integer (0xabadca11) in pngset.c where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1. -Version 1.7.0beta61 [May 20, 2015] +Version 1.7.0beta61 [May 31, 2015] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c - Avoid a harmless potential integer overflow in png_XYZ_from_xy(). + Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug + report from Christopher Ferris). + Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c + to avoid confusion with the libpng private macros. + Fixed old cut&paste bug in the weighted filter selection code in + pngwutil.c, introduced in libpng-0.95, March 1997. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 392466979..0c1a6ad85 100644 --- a/CHANGES +++ b/CHANGES @@ -5094,9 +5094,14 @@ Version 1.7.0beta60 [May 6, 2015] Replaced "unexpected" with an integer (0xabadca11) in pngset.c where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1. -Version 1.7.0beta61 [May 20, 2015] +Version 1.7.0beta61 [May 31, 2015] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds. - Avoid a harmless potential integer overflow in png_XYZ_from_xy(). + Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug + report from Christopher Ferris). + Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c + to avoid confusion with the libpng private macros. + Fixed old cut&paste bug in the weighted filter selection code in + pngwutil.c, introduced in libpng-0.95, March 1997. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/LICENSE b/LICENSE index 06e8e2431..949a0b7f8 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.0beta61, May 6, 2015, are +libpng versions 1.2.6, August 15, 2004, through 1.7.0beta61, May 31, 2015, are Copyright (c) 2004, 2006-2015 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 -May 6, 2015 +May 31, 2015 diff --git a/README b/README index 482be577b..2ea186ff7 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.7.0beta61 - May 6, 2015 (shared library 17.0) +README for libpng version 1.7.0beta61 - May 31, 2015 (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. @@ -134,7 +134,7 @@ and ...". If in doubt, send questions to me. I'll bounce them to others, if necessary. Please do not send suggestions on how to change PNG. We have -been discussing PNG for nineteen years now, and it is official and +been discussing PNG for twenty years now, and it is official and finished. If you have suggestions for libpng, however, I'll gladly listen. Even if your suggestion is not used immediately, it may be used later. diff --git a/contrib/tools/pngfix.c b/contrib/tools/pngfix.c index f788f0b46..00942627c 100644 --- a/contrib/tools/pngfix.c +++ b/contrib/tools/pngfix.c @@ -71,8 +71,8 @@ * with older builds. */ #if ZLIB_VERNUM < 0x1260 -# define PNGZ_MSG_CAST(s) png_constcast(char*,s) -# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b) +# define PNGZ_MSG_CAST(s) constcast(char*,s) +# define PNGZ_INPUT_CAST(b) constcast(png_bytep,b) #else # define PNGZ_MSG_CAST(s) (s) # define PNGZ_INPUT_CAST(b) (b) @@ -86,17 +86,17 @@ /* Copied from pngpriv.h */ #ifdef __cplusplus -# define png_voidcast(type, value) static_cast(value) -# define png_constcast(type, value) const_cast(value) -# define png_aligncast(type, value) \ +# define voidcast(type, value) static_cast(value) +# define constcast(type, value) const_cast(value) +# define aligncast(type, value) \ static_cast(static_cast(value)) -# define png_aligncastconst(type, value) \ +# define aligncastconst(type, value) \ static_cast(static_cast(value)) #else -# define png_voidcast(type, value) (value) -# define png_constcast(type, value) ((type)(value)) -# define png_aligncast(type, value) ((void*)(value)) -# define png_aligncastconst(type, value) ((const void*)(value)) +# define voidcast(type, value) (value) +# define constcast(type, value) ((type)(value)) +# define aligncast(type, value) ((void*)(value)) +# define aligncastconst(type, value) ((const void*)(value)) #endif /* __cplusplus */ #if PNG_LIBPNG_VER < 10700 @@ -446,7 +446,7 @@ static void make_random_bytes(png_uint_32* seed, void* pv, size_t size) { png_uint_32 u0 = seed[0], u1 = seed[1]; - png_bytep bytes = png_voidcast(png_bytep, pv); + png_bytep bytes = voidcast(png_bytep, pv); /* There are thirty-three bits; the next bit in the sequence is bit-33 XOR * bit-20. The top 1 bit is in u1, the bottom 32 are in u0. @@ -668,7 +668,7 @@ IDAT_list_extend(struct IDAT_list *tail) if (length < tail->length) /* arithmetic overflow */ length = tail->length; - next = png_voidcast(IDAT_list*, malloc(IDAT_list_size(NULL, length))); + next = voidcast(IDAT_list*, malloc(IDAT_list_size(NULL, length))); CLEAR(*next); /* The caller must handle this: */ @@ -3535,7 +3535,7 @@ get_control(png_const_structrp png_ptr) /* This just returns the (file*). The chunk and idat control structures * don't always exist. */ - struct control *control = png_voidcast(struct control*, + struct control *control = voidcast(struct control*, png_get_error_ptr(png_ptr)); return &control->file; } @@ -3543,7 +3543,7 @@ get_control(png_const_structrp png_ptr) static void allocate(struct file *file, int allocate_idat) { - struct control *control = png_voidcast(struct control*, file->alloc_ptr); + struct control *control = voidcast(struct control*, file->alloc_ptr); if (allocate_idat) { diff --git a/libpng-manual.txt b/libpng-manual.txt index 8269a8c02..a8eacbbe5 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.0beta61 - May 7, 2015 + libpng version 1.7.0beta61 - May 31, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 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.0beta61 - May 7, 2015 + libpng versions 0.97, January 1998, through 1.7.0beta61 - May 31, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -5346,7 +5346,7 @@ Other rules can be inferred by inspecting the libpng source. XVII. Y2K Compliance in libpng -May 7, 2015 +May 31, 2015 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 770473cef..4559ee9c6 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "May 7, 2015" +.TH LIBPNG 3 "May 31, 2015" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta61 .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.0beta61 - May 7, 2015 + libpng version 1.7.0beta61 - May 31, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 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.0beta61 - May 7, 2015 + libpng versions 0.97, January 1998, through 1.7.0beta61 - May 31, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -5840,7 +5840,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XVII. Y2K Compliance in libpng -May 7, 2015 +May 31, 2015 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -6157,7 +6157,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.7.0beta61 - May 7, 2015: +Libpng version 1.7.0beta61 - May 31, 2015: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6180,7 +6180,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.7.0beta61, May 7, 2015, are +libpng versions 1.2.6, August 15, 2004, through 1.7.0beta61, May 31, 2015, are Copyright (c) 2004,2006-2015 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 @@ -6279,7 +6279,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -May 7, 2015 +May 31, 2015 .\" end of man page diff --git a/libpngpf.3 b/libpngpf.3 index e642f3d74..a243457a3 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,4 +1,4 @@ -.TH LIBPNGPF 3 "May 6, 2015" +.TH LIBPNGPF 3 "May 31, 2015" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta61 (private functions) diff --git a/png.5 b/png.5 index 766fe3e79..1276a880e 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "May 6, 2015" +.TH PNG 5 "May 31, 2015" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index 2fd92e1a0..4530bd0d7 100644 --- a/png.c +++ b/png.c @@ -689,13 +689,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.7.0beta61 - May 20, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.7.0beta61 - May 31, 2015" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2015 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.0beta61 - May 20, 2015\ + return "libpng version 1.7.0beta61 - May 31, 2015\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; diff --git a/png.h b/png.h index d5f7441a1..1d71d050b 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.7.0beta61, May 6, 2015 + * libpng version 1.7.0beta61, May 31, 2015 * * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,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.0beta61, May 6, 2015: Glenn + * libpng versions 0.97, January 1998, through 1.7.0beta61, May 31, 2015: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -248,7 +248,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta61, May 6, 2015, are + * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta61, May 31, 2015, are * Copyright (c) 2004, 2006-2015 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: @@ -360,7 +360,7 @@ * Y2K compliance in libpng: * ========================= * - * May 6, 2015 + * May 31, 2015 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -430,7 +430,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.7.0beta61" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.7.0beta61 - May 6, 2015\n" + " libpng version 1.7.0beta61 - May 31, 2015\n" #define PNG_LIBPNG_VER_SONUM 17 #define PNG_LIBPNG_VER_DLLNUM 17 diff --git a/pngconf.h b/pngconf.h index e02a5d232..ff258bd5e 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.7.0beta61, May 6, 2015 + * libpng version 1.7.0beta61, May 31, 2015 * * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngstruct.h b/pngstruct.h index 52b4869ae..dfe3f2b71 100644 --- a/pngstruct.h +++ b/pngstruct.h @@ -330,15 +330,23 @@ struct png_struct_def * * Members that hold pointers to the decompressed image rows. */ - png_bytep row_buf; /* buffer for the current (unfiltered) row */ + png_bytep row_buf; /* buffer to save current (unfiltered) row. + * While reading, this is a pointer into + * big_row_buf; while writing it is separately + * allocated. + */ #if defined(PNG_WRITE_FILTER_SUPPORTED) || defined(PNG_READ_SUPPORTED) - png_bytep prev_row; /* buffer to save the previous (unfiltered) row */ + png_bytep prev_row; /* buffer to save previous (unfiltered) row. + * While reading this is a pointer into + * big_prev_row; while writing it is separately + * allocated if needed. + */ #endif #ifdef PNG_READ_SUPPORTED /* The row_buf and prev_row pointers are misaligned so that the start of the * row - after the filter byte - is aligned, the 'big_' pointers record the - * original allocated pointer. + * original allocated pointer. These are only used while reading. */ png_bytep big_row_buf; png_bytep big_prev_row; diff --git a/pngwutil.c b/pngwutil.c index 4167d4876..e698f49f5 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -2841,7 +2841,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info) for (j = 0; j < num_p_filters; j++) { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG) { sumlo = (sumlo * png_ptr->filter_weights[j]) >> PNG_WEIGHT_SHIFT; diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt index e0006e523..33d42b357 100644 --- a/projects/vstudio/readme.txt +++ b/projects/vstudio/readme.txt @@ -1,7 +1,7 @@ VisualStudio instructions -libpng version 1.7.0beta61 - May 6, 2015 +libpng version 1.7.0beta61 - May 31, 2015 Copyright (c) 1998-2010 Glenn Randers-Pehrson diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props index 58a325b98..1ce25f411 100644 --- a/projects/vstudio/zlib.props +++ b/projects/vstudio/zlib.props @@ -2,7 +2,7 @@