From 38647d4b21f2ba1c95107837786cd95a9181c9e7 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Fri, 18 Sep 2015 16:22:38 -0500 Subject: [PATCH] [libpng17] Fixed makepng.c so that it compiles with GCC 5.1.0. Added contrib/testspngs/: a directory for additional test png files --- ANNOUNCE | 3 ++ CHANGES | 3 ++ CMakeLists.txt | 2 +- LICENSE | 4 +- README | 2 +- configure.ac | 4 +- contrib/libtests/makepng.c | 27 +++++++++++-- contrib/testpngs/makepngs.sh | 72 +++++++++++++++++++++++++++++++++++ libpng-manual.txt | 8 ++-- libpng.3 | 20 +++++----- libpngpf.3 | 4 +- png.5 | 2 +- png.c | 11 +++--- png.h | 20 +++++----- pngconf.h | 2 +- pngread.c | 25 +++++------- pngrtran.c | 8 ---- pngrutil.c | 5 --- pngset.c | 10 ++--- pngstruct.h | 6 ++- pngtest.c | 3 ++ projects/vstudio/readme.txt | 2 +- projects/vstudio/zlib.props | 2 +- scripts/README.txt | 10 ++--- scripts/def.c | 2 +- scripts/libpng-config-head.in | 2 +- scripts/libpng.pc.in | 2 +- scripts/makefile.ne12bsd | 2 +- scripts/makefile.netbsd | 2 +- scripts/makefile.openbsd | 2 +- scripts/pnglibconf.h.prebuilt | 4 +- scripts/symbols.def | 2 +- 32 files changed, 177 insertions(+), 96 deletions(-) create mode 100755 contrib/testpngs/makepngs.sh diff --git a/ANNOUNCE b/ANNOUNCE index 322abe328..509fcbf8f 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -882,6 +882,9 @@ Version 1.7.0beta66 [September 18, 2015] not required at present but it may prevent a bug being introduced in the future. Fixed some new Coverity defects that were introduced in 1.7.0beta65. + Fixed makepng.c so that it compiles with GCC 5.1.0. + Added contrib/testspngs/: a directory for additional test png files + generated by makepng. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index a54d22345..e0549029f 100644 --- a/CHANGES +++ b/CHANGES @@ -5179,6 +5179,9 @@ Version 1.7.0beta66 [September 18, 2015] not required at present but it may prevent a bug being introduced in the future. Fixed some new Coverity defects that were introduced in 1.7.0beta65. + Fixed makepng.c so that it compiles with GCC 5.1.0. + Added contrib/testspngs/: a directory for additional test png files + generated by makepng. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CMakeLists.txt b/CMakeLists.txt index 74416fb08..bf9a58d6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,7 +261,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW) # SET UP LINKS if(PNG_SHARED) set_target_properties(${PNG_LIB_NAME} PROPERTIES -# VERSION 17.${PNGLIB_RELEASE}.1.7.0beta65 +# VERSION 17.${PNGLIB_RELEASE}.1.7.0beta66 VERSION 17.${PNGLIB_RELEASE}.0 SOVERSION 17 CLEAN_DIRECT_OUTPUT 1) diff --git a/LICENSE b/LICENSE index d97560024..e4dcf9b5a 100644 --- a/LICENSE +++ b/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000, through 1.7.0beta65, September 16, 2015, are +libpng versions 1.0.7, July 1, 2000, through 1.7.0beta66, September 18, 2015, are Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -104,4 +104,4 @@ the additional disclaimers inserted at version 1.0.7. Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 16, 2015 +September 18, 2015 diff --git a/README b/README index bbc4e8084..6ae8c7ace 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.7.0beta65 - September 16, 2015 (shared library 17.0) +README for libpng version 1.7.0beta66 - September 18, 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. diff --git a/configure.ac b/configure.ac index e0fa67904..6a76ae6d3 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AC_PREREQ([2.68]) dnl Version number stuff here: -AC_INIT([libpng],[1.7.0beta65],[png-mng-implement@lists.sourceforge.net]) +AC_INIT([libpng],[1.7.0beta66],[png-mng-implement@lists.sourceforge.net]) AC_CONFIG_MACRO_DIR([scripts]) # libpng does not follow GNU file name conventions (hence 'foreign') @@ -40,7 +40,7 @@ dnl automake, so the following is not necessary (and is not defined anyway): dnl AM_PREREQ([1.11.2]) dnl stop configure from automagically running automake -PNGLIB_VERSION=1.7.0beta65 +PNGLIB_VERSION=1.7.0beta66 PNGLIB_MAJOR=1 PNGLIB_MINOR=7 PNGLIB_RELEASE=0 diff --git a/contrib/libtests/makepng.c b/contrib/libtests/makepng.c index c2932824f..73fa44755 100644 --- a/contrib/libtests/makepng.c +++ b/contrib/libtests/makepng.c @@ -82,6 +82,7 @@ #include #include #include +#include #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H) # include @@ -96,6 +97,23 @@ # include "../../png.h" #endif +/* Work round for GCC complaints about casting a (double) function result to + * an unsigned: + */ +static unsigned int +flooru(double d) +{ + d = floor(d); + return (unsigned int)d; +} + +static png_byte +floorb(double d) +{ + d = floor(d); + return (png_byte)d; +} + /* This structure is used for inserting extra chunks (the --insert argument, not * documented above.) */ @@ -217,7 +235,8 @@ generate_palette(png_colorp palette, png_bytep trans, int bit_depth, else { unsigned int size = 1U << (bit_depth/2); /* 2, 4 or 16 */ - unsigned int x, y, ip; + unsigned int x, y; + volatile unsigned int ip = 0; for (x=0; x> 8); *row = (png_byte)value; return; @@ -625,7 +644,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth, gamma_table[0] = 0; for (i=1; i<255; ++i) - gamma_table[i] = (png_byte)floor(pow(i/255.,conv) * 255 + .5); + gamma_table[i] = floorb(pow(i/255.,conv) * 255 + .5); gamma_table[255] = 255; } @@ -831,7 +850,7 @@ static png_size_t load_fake(png_charp param, png_bytepp profile) { char *endptr = NULL; - unsigned long long int size = strtoull(param, &endptr, 0/*base*/); + uint64_t size = strtoull(param, &endptr, 0/*base*/); /* The 'fake' format is *[string] */ if (endptr != NULL && *endptr == '*') diff --git a/contrib/testpngs/makepngs.sh b/contrib/testpngs/makepngs.sh new file mode 100755 index 000000000..9b2b5c458 --- /dev/null +++ b/contrib/testpngs/makepngs.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Make a set of test PNG files, MAKEPNG is the name of the makepng executable +# built from contrib/libtests/makepng.c +# +# The arguments say whether to build all the files or whether just to build the +# ones that extend the code-coverage of libpng from the existing test files in +# contrib/pngsuite. +test -n "$MAKEPNG" || MAKEPNG=./makepng + +mp(){ + ${MAKEPNG} $1 "$3" "$4" "$2$3-$4.png" +} + +mpg(){ + if test "$g" = "none" + then + mp "" "" "$2" "$3" + else + mp "--$1" "$1-" "$2" "$3" + fi +} + +case "$1" in + --all) + for g in none sRGB linear 1.8 + do + for c in gray palette + do + for b in 1 2 4 + do + mpg "$g" "$c" "$b" + done + done + + mpg "$g" palette 8 + + for c in gray gray-alpha rgb rgb-alpha + do + for b in 8 16 + do + mpg "$g" "$c" "$b" + done + done + done;; + + --coverage) + # Comments below indicate cases known to be required and not duplicated + # in other (required) cases; the aim is to get a minimal set that gives + # the maxium code coverage. + mpg none gray 16 + mpg none gray-alpha 16 + mpg none gray-alpha 8 # required + mpg none palette 8 + mpg none rgb-alpha 8 + mpg 1.8 gray 2 + mpg 1.8 palette 2 # required + mpg 1.8 palette 4 # required + mpg 1.8 palette 8 + mpg linear palette 8 + mpg linear rgb-alpha 16 + mpg sRGB gray-alpha 8 + mpg sRGB palette 1 # required + mpg sRGB palette 8 + mpg sRGB rgb-alpha 16 # required pngread.c:2422 untested + mpg sRGB rgb-alpha 8;; + + *) + echo "$0 $1: unknown argument, usage:" >&2 + echo " $0 [--all|--coverage" >&2 + exit 1 +esac diff --git a/libpng-manual.txt b/libpng-manual.txt index edb1c9f4e..d37214488 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.0beta65 - September 16, 2015 + libpng version 1.7.0beta66 - September 18, 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.0beta65 - September 16, 2015 + libpng versions 0.97, January 1998, through 1.7.0beta66 - September 18, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -5317,13 +5317,13 @@ Other rules can be inferred by inspecting the libpng source. XVII. Y2K Compliance in libpng -September 16, 2015 +September 18, 2015 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.7.0beta65 are Y2K compliant. It is my belief that earlier +upward through 1.7.0beta66 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/libpng.3 b/libpng.3 index 0b871e0f9..c9097f245 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "September 16, 2015" +.TH LIBPNG 3 "September 18, 2015" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta65 +libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta66 .SH SYNOPSIS \fB #include \fP @@ -498,7 +498,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.0beta65 - September 16, 2015 + libpng version 1.7.0beta66 - September 18, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -509,7 +509,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.7.0beta65 - September 16, 2015 + libpng versions 0.97, January 1998, through 1.7.0beta66 - September 18, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -5815,13 +5815,13 @@ Other rules can be inferred by inspecting the libpng source. .SH XVII. Y2K Compliance in libpng -September 16, 2015 +September 18, 2015 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.7.0beta65 are Y2K compliant. It is my belief that earlier +upward through 1.7.0beta66 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer @@ -6080,7 +6080,7 @@ the first widely used release: 1.6.18 16 10618 16.so.16.18[.0] 1.6.19beta01 16 10619 16.so.16.19[.0] 1.7.0alpha01-10 17 10700 17.so.17.0[.0] - 1.7.0beta01-65 17 10700 17.so.17.0[.0] + 1.7.0beta01-66 17 10700 17.so.17.0[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -6137,7 +6137,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.7.0beta65 - September 16, 2015: +Libpng version 1.7.0beta66 - September 18, 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). @@ -6160,7 +6160,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000, through 1.7.0beta65, September 16, 2015, are +libpng versions 1.0.7, July 1, 2000, through 1.7.0beta66, September 18, 2015, are Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -6254,7 +6254,7 @@ the additional disclaimers inserted at version 1.0.7. Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 16, 2015 +September 18, 2015 .\" end of man page diff --git a/libpngpf.3 b/libpngpf.3 index 089ea21bf..ae3d96099 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "September 16, 2015" +.TH LIBPNGPF 3 "September 18, 2015" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta65 +libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta66 (private functions) .SH SYNOPSIS \fB#include \fI"pngpriv.h" diff --git a/png.5 b/png.5 index 833f443a2..a3fc0a7de 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "September 16, 2015" +.TH PNG 5 "September 18, 2015" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index 412c2003c..c60b8c433 100644 --- a/png.c +++ b/png.c @@ -15,7 +15,7 @@ #define PNG_SRC_FILE PNG_SRC_FILE_png /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_7_0beta65 Your_png_h_is_not_version_1_7_0beta65; +typedef png_libpng_version_1_7_0beta66 Your_png_h_is_not_version_1_7_0beta66; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -141,10 +141,9 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length) do { uInt safe_length = (uInt)length; -#ifndef __COVERITY__ + if (safe_length == 0) - safe_length = (uInt)-1; /* evil, but safe */ -#endif + safe_length = ZLIB_IO_MAX; crc = crc32(crc, ptr, safe_length); @@ -694,13 +693,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.7.0beta65 - September 16, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.7.0beta66 - September 18, 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.0beta65 - September 16, 2015\ + return "libpng version 1.7.0beta66 - September 18, 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 762fef467..acd111340 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.7.0beta65, September 16, 2015 + * libpng version 1.7.0beta66, September 18, 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.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.7.0beta65, September 16, 2015: Glenn + * libpng versions 0.97, January 1998, through 1.7.0beta66, September 18, 2015: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -220,7 +220,7 @@ * 1.6.18rc01-03 16 10618 16.so.16.18[.0] * 1.6.18 16 10618 16.so.16.18[.0] * 1.7.0alpha01-10 17 10700 17.so.17.0[.0] - * 1.7.0beta01-65 17 10700 17.so.17.0[.0] + * 1.7.0beta01-66 17 10700 17.so.17.0[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -252,7 +252,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000, through 1.7.0beta65, September 16, 2015, are + * libpng versions 1.0.7, July 1, 2000, through 1.7.0beta66, September 18, 2015, are * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.0.6 * with the following individuals added to the list of Contributing Authors: @@ -361,13 +361,13 @@ * Y2K compliance in libpng: * ========================= * - * September 16, 2015 + * September 18, 2015 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.7.0beta65 are Y2K compliant. It is my belief that + * upward through 1.7.0beta66 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -429,9 +429,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.7.0beta65" +#define PNG_LIBPNG_VER_STRING "1.7.0beta66" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.7.0beta65 - September 16, 2015\n" + " libpng version 1.7.0beta66 - September 18, 2015\n" #define PNG_LIBPNG_VER_SONUM 17 #define PNG_LIBPNG_VER_DLLNUM 17 @@ -445,7 +445,7 @@ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 65 +#define PNG_LIBPNG_VER_BUILD 66 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -705,7 +705,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_7_0beta65; +typedef char* png_libpng_version_1_7_0beta66; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/pngconf.h b/pngconf.h index 589902280..396320e18 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.7.0beta65, September 16, 2015 + * libpng version 1.7.0beta66, September 18, 2015 * * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngread.c b/pngread.c index 87c4d2042..5295bbcaa 100644 --- a/pngread.c +++ b/pngread.c @@ -2109,14 +2109,11 @@ png_image_read_colormap(png_voidp argument) output_processing = PNG_CMAP_NONE; break; } -#ifdef __COVERITY__ - /* Coverity claims that output_encoding cannot be 2 (P_LINEAR) - * here. - */ - back_alpha = 255; -#else - back_alpha = output_encoding == P_LINEAR ? 65535 : 255; -#endif + /* Coverity claims that output_encoding cannot be 2 (P_LINEAR) + * here. + */ + affirm(output_encoding != P_LINEAR); + back_alpha = 255U; } /* output_processing means that the libpng-processed row will be @@ -2238,17 +2235,13 @@ png_image_read_colormap(png_voidp argument) /* NOTE: this preserves the full precision of the application * background color. + * + * Coverity claims that output_encoding cannot be 2 (P_LINEAR) */ + affirm(output_encoding != P_LINEAR); background_index = i; png_create_colormap_entry(display, i++, back_r, back_g, back_b, -#ifdef __COVERITY__ - /* Coverity claims that output_encoding cannot be 2 (P_LINEAR) - * here. - */ 255U, -#else - output_encoding == P_LINEAR ? 65535U : 255U, -#endif - output_encoding); + 255U, output_encoding); /* For non-opaque input composite on the sRGB background - this * requires inverting the encoding for each component. The input diff --git a/pngrtran.c b/pngrtran.c index c72f6e8e2..cf9b1eeda 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -897,10 +897,8 @@ png_do_expand_lbd_gray(png_transformp *transform, png_transform_controlp tc) /* This helps avoid cluttering the code up with #ifdefs: */ # define check_tRNS if (do_alpha) *--dp = (pixel != gray) * 255U; -# define UNTESTED_tRNS if (do_alpha) UNTESTED # else /* !READ_tRNS */ # define check_tRNS -# define UNTESTED_tRNS # endif /* READ_tRNS */ dp += PNG_TC_ROWBYTES(*tc); /* pre-decremented below */ @@ -4986,10 +4984,7 @@ png_do_background_alpha_RGBA(png_transformp *transform, case 65535U: /* opaque */ if (copy) - { memcpy(dp, sp, 8U); - UNTESTED - } break; } @@ -5303,12 +5298,9 @@ png_init_background(png_transformp *transform, png_transform_controlp tc) */ if ((tc->format & PNG_FORMAT_FLAG_ALPHA) != 0) { - /* TODO: it may be impossible to get here! */ affirm(tc->transparent_alpha); /* This init routine does the sBIT handling: */ - UNTESTED png_init_background_transparent(transform, tc); - UNTESTED } else if (!tc->palette && png_ptr->num_trans == 1 && diff --git a/pngrutil.c b/pngrutil.c index 29be39a16..83e98ddf3 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1402,11 +1402,6 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr) else if (size > 0) errmsg = "truncated"; - -#ifndef __COVERITY__ - else - errmsg = png_ptr->zstream.msg; -#endif } /* else png_icc_check_tag_table output an error */ diff --git a/pngset.c b/pngset.c index 1933a7b34..16549b03d 100644 --- a/pngset.c +++ b/pngset.c @@ -1537,7 +1537,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size) png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */ return; } -# endif +# endif /* SEQUENTIAL_READ */ # ifdef PNG_WRITE_SUPPORTED if (!png_ptr->read_struct) @@ -1550,9 +1550,8 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size) return; } -#ifndef __COVERITY__ - /* Some compilers complain that this is always false. However, it - * can be true when integer overflow happens. + /* NOTE: size is limited to 0..PNG_UINT_31_MAX (2^31-1) at this point, + * however ZLIB_IO_MAX may be smaller (for example on a 16-bit system). */ if (size > ZLIB_IO_MAX) { @@ -1560,7 +1559,6 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size) "Compression buffer size limited to system maximum"); size = ZLIB_IO_MAX; /* must fit */ } -#endif if (size < 6) { @@ -1579,7 +1577,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size) png_ptr->zbuffer_size = (uInt)size; } } -# endif +# endif /* WRITE */ } void PNGAPI diff --git a/pngstruct.h b/pngstruct.h index fac39a2a5..d85ad2c3c 100644 --- a/pngstruct.h +++ b/pngstruct.h @@ -55,7 +55,11 @@ * even improve performance on some systems (and degrade it on others.) */ #ifndef ZLIB_IO_MAX -# define ZLIB_IO_MAX ((uInt)-1) +# ifdef __COVERITY__ +# define ZLIB_IO_MAX ((uInt)255U) /* else COVERITY whines */ +# else +# define ZLIB_IO_MAX ((uInt)-1) +# endif /* COVERITY */ #endif #ifdef PNG_WRITE_SUPPORTED diff --git a/pngtest.c b/pngtest.c index 8c4ce2979..c9140141f 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1071,6 +1071,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) /*NOT REACHED*/ } } + + else + png_error(read_ptr, "png_get_IHDR failed"); } #ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_cHRM_SUPPORTED diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt index bac488db6..52b85a0d3 100644 --- a/projects/vstudio/readme.txt +++ b/projects/vstudio/readme.txt @@ -1,7 +1,7 @@ VisualStudio instructions -libpng version 1.7.0beta65 - September 16, 2015 +libpng version 1.7.0beta66 - September 18, 2015 Copyright (c) 1998-2010 Glenn Randers-Pehrson diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props index 59793c168..cfdc24e60 100644 --- a/projects/vstudio/zlib.props +++ b/projects/vstudio/zlib.props @@ -2,7 +2,7 @@