diff -ru4NwbB libpng-1.2.50/configure.ac libpng-1.2.51rc03/configure.ac --- libpng-1.2.50/configure.ac 2012-07-09 19:37:11.299422964 -0500 +++ libpng-1.2.51rc03/configure.ac 2014-02-03 09:56:56.742360833 -0600 @@ -30,9 +30,9 @@ dnl End of version number stuff AC_CONFIG_SRCDIR([pngget.c]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_LD diff -ru4NwbB libpng-1.2.50/contrib/gregbook/readpng.c libpng-1.2.51rc03/contrib/gregbook/readpng.c --- libpng-1.2.50/contrib/gregbook/readpng.c 2012-07-09 19:36:57.183048788 -0500 +++ libpng-1.2.51rc03/contrib/gregbook/readpng.c 2014-02-03 09:56:42.624781437 -0600 @@ -213,8 +213,12 @@ /* setjmp() must be called in every function that calls a PNG-reading * libpng function */ if (setjmp(png_jmpbuf(png_ptr))) { + free(image_data); + image_data = NULL; + free(row_pointers); + row_pointers = NULL; png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return NULL; } diff -ru4NwbB libpng-1.2.50/contrib/pngminim/encoder/README libpng-1.2.51rc03/contrib/pngminim/encoder/README --- libpng-1.2.50/contrib/pngminim/encoder/README 2012-07-09 19:36:57.677368183 -0500 +++ libpng-1.2.51rc03/contrib/pngminim/encoder/README 2014-02-03 09:56:43.143793774 -0600 @@ -1,7 +1,7 @@ This demonstrates the use of PNG_USER_CONFIG and pngusr.h -To build a minimal write-only decoder with embedded libpng and zlib, run +To build a minimal write-only encoder with embedded libpng and zlib, run gather.sh # to collect needed files from pngminus, libpng, and zlib make diff -ru4NwbB libpng-1.2.50/png.c libpng-1.2.51rc03/png.c --- libpng-1.2.50/png.c 2012-07-09 19:36:56.931670273 -0500 +++ libpng-1.2.51rc03/png.c 2014-02-03 09:56:42.359333513 -0600 @@ -1,9 +1,9 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.2.46 [February 25, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.2.51 [February 3, 2014] + * Copyright (c) 1998-2014 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.) * * This code is released under the libpng license. @@ -717,22 +717,22 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { - png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ #ifdef PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT #else #ifdef __STDC__ return ((png_charp) PNG_STRING_NEWLINE \ "libpng version 1.2.51rc03 - February 3, 2014" PNG_STRING_NEWLINE \ - "Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ + "Copyright (c) 1998-2014 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 ((png_charp) "libpng version 1.2.51rc03 - February 3, 2014\ - Copyright (c) 1998-2011 Glenn Randers-Pehrson\ + Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); #endif #endif @@ -749,25 +749,25 @@ png_charp PNGAPI png_get_libpng_ver(png_structp png_ptr) { /* Version of *.c files used when building libpng */ - png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ return ((png_charp) PNG_LIBPNG_VER_STRING); } png_charp PNGAPI png_get_header_ver(png_structp png_ptr) { /* Version of *.h files used when building libpng */ - png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ return ((png_charp) PNG_LIBPNG_VER_STRING); } png_charp PNGAPI png_get_header_version(png_structp png_ptr) { /* Returns longer string containing both version and date */ - png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ + PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ #ifdef __STDC__ return ((png_charp) PNG_HEADER_VERSION_STRING #ifndef PNG_READ_SUPPORTED " (NO READ SUPPORT)" @@ -1008,16 +1008,8 @@ png_warning(png_ptr, "Invalid image height in IHDR"); error = 1; } - if ( width > (PNG_UINT_32_MAX - >> 3) /* 8-byte RGBA pixels */ - - 64 /* bigrowbuf hack */ - - 1 /* filter byte */ - - 7*8 /* rounding of width to multiple of 8 pixels */ - - 8) /* extra max_pixel_depth pad */ - png_warning(png_ptr, "Width is too large for libpng to process pixels"); - /* Check other values */ if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && bit_depth != 8 && bit_depth != 16) { diff -ru4NwbB libpng-1.2.50/png.h libpng-1.2.51rc03/png.h --- libpng-1.2.50/png.h 2012-07-09 19:36:56.905164590 -0500 +++ libpng-1.2.51rc03/png.h 2014-02-03 09:56:42.332350703 -0600 @@ -1,8 +1,8 @@ /* png.h - header file for PNG reference library * * libpng version 1.2.51rc03 - February 3, 2014 - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Copyright (c) 1998-2014 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.) * * This code is released under the libpng license (See LICENSE, below) @@ -283,8 +283,12 @@ * 1.0.59 10 10059 10.so.0.59[.0] * 1.2.49 13 10249 12.so.0.49[.0] * 1.0.60 10 10060 10.so.0.60[.0] * 1.2.50 13 10250 12.so.0.50[.0] + * 1.2.51beta01-05 13 10251 12.so.0.51[.0] + * 1.2.51rc01-03 13 10251 12.so.0.51[.0] + * 1.0.61 10 10061 10.so.0.61[.0] + * 1.2.51 13 10251 12.so.0.51[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The @@ -315,9 +319,9 @@ * * This code is released under the libpng license. * * libpng versions 1.2.6, August 15, 2004, through 1.2.51rc03, February 3, 2014, are - * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and 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: * * Cosmin Truta diff -ru4NwbB libpng-1.2.50/pngconf.h libpng-1.2.51rc03/pngconf.h --- libpng-1.2.50/pngconf.h 2012-07-09 19:36:56.915063752 -0500 +++ libpng-1.2.51rc03/pngconf.h 2014-02-03 09:56:42.342607489 -0600 @@ -1,9 +1,9 @@ /* pngconf.h - machine configurable file for libpng * * libpng version 1.2.51rc03 - February 3, 2014 - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * 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.) * * This code is released under the libpng license. @@ -85,8 +85,20 @@ # define PNG_WARN_UNINITIALIZED_ROW 1 #endif /* End of material added at libpng-1.2.19/1.2.21 */ +/* Added at libpng-1.2.51 (ported from 1.4.6) */ +#ifndef PNG_UNUSED +/* Unused formal parameter warnings are silenced using the following macro + * which is expected to have no bad effects on performance (optimizing + * compilers will probably remove it entirely). Note that if you replace + * it with something other than whitespace, you must include the terminating + * semicolon. + */ +# define PNG_UNUSED(param) (void)param; +#endif +/* End of material added to libpng-1.4.6 */ + /* This is the size of the compression buffer, and thus the size of * an IDAT chunk. Make this whatever size you feel is best for your * machine. One of these will be allocated per png_struct. When this * is full, it writes the data to the disk, and does some other @@ -867,9 +879,9 @@ /* Added at libpng-1.2.43. To accept all valid PNGs no matter * how large, set these two limits to 0. */ #ifndef PNG_USER_CHUNK_CACHE_MAX -# define PNG_USER_CHUNK_CACHE_MAX 0 +# define PNG_USER_CHUNK_CACHE_MAX 32765 #endif /* Added at libpng-1.2.43 */ #ifndef PNG_USER_CHUNK_MALLOC_MAX diff -ru4NwbB libpng-1.2.50/pngerror.c libpng-1.2.51rc03/pngerror.c --- libpng-1.2.50/pngerror.c 2012-07-09 19:36:56.937876916 -0500 +++ libpng-1.2.51rc03/pngerror.c 2014-02-03 09:56:42.365642945 -0600 @@ -299,9 +299,9 @@ #endif /* Here if not setjmp support or if png_ptr is null. */ PNG_ABORT(); #ifndef PNG_CONSOLE_IO_SUPPORTED - error_message = error_message; /* Make compiler happy */ + PNG_UNUSED(error_message) /* Make compiler happy */ #endif } #ifdef PNG_WARNINGS_SUPPORTED @@ -345,11 +345,11 @@ fprintf(stderr, "libpng warning: %s", warning_message); fprintf(stderr, PNG_STRING_NEWLINE); } #else - warning_message = warning_message; /* Make compiler happy */ + PNG_UNUSED(warning_message) /* Make compiler happy */ #endif - png_ptr = png_ptr; /* Make compiler happy */ + PNG_UNUSED(png_ptr) /* Make compiler happy */ } #endif /* PNG_WARNINGS_SUPPORTED */ /* This function is called when the application wants to use another method diff -ru4NwbB libpng-1.2.50/pngget.c libpng-1.2.51rc03/pngget.c --- libpng-1.2.50/pngget.c 2012-07-09 19:36:56.950821288 -0500 +++ libpng-1.2.51rc03/pngget.c 2014-02-03 09:56:42.378265563 -0600 @@ -892,9 +892,9 @@ png_uint_32 PNGAPI png_get_asm_flagmask (int flag_select) { /* Obsolete, to be removed from libpng-1.4.0 */ - flag_select=flag_select; + PNG_UNUSED(flag_select) return 0L; } /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ @@ -902,9 +902,9 @@ png_uint_32 PNGAPI png_get_mmx_flagmask (int flag_select, int *compilerID) { /* Obsolete, to be removed from libpng-1.4.0 */ - flag_select=flag_select; + PNG_UNUSED(flag_select) *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ return 0L; } diff -ru4NwbB libpng-1.2.50/pngread.c libpng-1.2.51rc03/pngread.c --- libpng-1.2.50/pngread.c 2012-07-09 19:36:56.974932198 -0500 +++ libpng-1.2.51rc03/pngread.c 2014-02-03 09:56:42.402578209 -0600 @@ -1,9 +1,9 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.48 [March 8, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.2.51 [%RDATE%] + * Copyright (c) 1998-2014 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.) * * This code is released under the libpng license. @@ -1404,9 +1404,9 @@ */ if (transforms & PNG_TRANSFORM_EXPAND) if ((png_ptr->bit_depth < 8) || (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || - (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) + (info_ptr->valid & PNG_INFO_tRNS)) png_set_expand(png_ptr); #endif /* We don't handle background color or gamma transformation or dithering. @@ -1423,16 +1423,10 @@ /* If you want to shift the pixel values from the range [0,255] or * [0,65535] to the original [0,7] or [0,31], or whatever range the * colors were originally in: */ - if ((transforms & PNG_TRANSFORM_SHIFT) - && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) - { - png_color_8p sig_bit; - - png_get_sBIT(png_ptr, info_ptr, &sig_bit); - png_set_shift(png_ptr, sig_bit); - } + if ((transforms & PNG_TRANSFORM_SHIFT) && (info_ptr->valid & PNG_INFO_sBIT)) + png_set_shift(png_ptr, &info_ptr->sig_bit); #endif #ifdef PNG_READ_BGR_SUPPORTED /* Flip the RGB pixels to BGR (or RGBA to BGRA) @@ -1505,10 +1499,10 @@ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ png_read_end(png_ptr, info_ptr); - transforms = transforms; /* Quiet compiler warnings */ - params = params; + PNG_UNUSED(transforms) /* Quiet compiler warnings */ + PNG_UNUSED(params); } #endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ diff -ru4NwbB libpng-1.2.50/pngrtran.c libpng-1.2.51rc03/pngrtran.c --- libpng-1.2.50/pngrtran.c 2012-07-09 19:36:56.996883555 -0500 +++ libpng-1.2.51rc03/pngrtran.c 2014-02-03 09:56:42.424679564 -0600 @@ -1,9 +1,9 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.49 [March 29, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.2.51 [February 3, 2014] + * Copyright (c) 1998-2014 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.) * * This code is released under the libpng license. @@ -916,9 +916,12 @@ k=0; for (i=0; inum_trans; i++) { if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) + { k=1; /* Partial transparency is present */ + break; + } } if (k == 0) png_ptr->transformations &= ~PNG_GAMMA; } diff -ru4NwbB libpng-1.2.50/pngrutil.c libpng-1.2.51rc03/pngrutil.c --- libpng-1.2.50/pngrutil.c 2012-07-09 19:36:57.011011459 -0500 +++ libpng-1.2.51rc03/pngrutil.c 2014-02-03 09:56:42.438796522 -0600 @@ -658,9 +658,9 @@ png_warning(png_ptr, "Incorrect IEND chunk length"); } png_crc_finish(png_ptr, length); - info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ + PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */ } #ifdef PNG_READ_gAMA_SUPPORTED void /* PRIVATE */ @@ -2464,9 +2464,9 @@ png_crc_finish(png_ptr, skip); #ifndef PNG_READ_USER_CHUNKS_SUPPORTED - info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ + PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */ #endif } /* This function is called to verify that a chunk name is valid. @@ -2920,9 +2920,9 @@ row_info->width = final_width; row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); } #ifndef PNG_READ_PACKSWAP_SUPPORTED - transformations = transformations; /* Silence compiler warning */ + PNG_UNUSED(transformations) /* Silence compiler warning */ #endif } #endif /* PNG_READ_INTERLACING_SUPPORTED */ diff -ru4NwbB libpng-1.2.50/pngset.c libpng-1.2.51rc03/pngset.c --- libpng-1.2.50/pngset.c 2012-07-09 19:36:57.019705149 -0500 +++ libpng-1.2.51rc03/pngset.c 2014-02-03 09:56:42.447593917 -0600 @@ -1,9 +1,9 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.49 [March 29, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.2.51 [February 3, 2014] + * Copyright (c) 1998-2014 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.) * * This code is released under the libpng license. @@ -554,16 +554,21 @@ #endif #endif #ifdef PNG_cHRM_SUPPORTED +# ifdef PNG_FIXED_POINT_SUPPORTED int_white_x = 31270L; int_white_y = 32900L; int_red_x = 64000L; int_red_y = 33000L; int_green_x = 30000L; int_green_y = 60000L; int_blue_x = 15000L; int_blue_y = 6000L; + png_set_cHRM_fixed(png_ptr, info_ptr, + int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, + int_green_y, int_blue_x, int_blue_y); +# endif #ifdef PNG_FLOATING_POINT_SUPPORTED white_x = (float).3127; white_y = (float).3290; @@ -572,16 +577,8 @@ green_x = (float).30; green_y = (float).60; blue_x = (float).15; blue_y = (float).06; -#endif - -#ifdef PNG_FIXED_POINT_SUPPORTED - png_set_cHRM_fixed(png_ptr, info_ptr, - int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, - int_green_y, int_blue_x, int_blue_y); -#endif -#ifdef PNG_FLOATING_POINT_SUPPORTED png_set_cHRM(png_ptr, info_ptr, white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); #endif #endif /* cHRM */ @@ -849,8 +846,14 @@ if (png_ptr == NULL || info_ptr == NULL) return; + if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Ignoring invalid num_trans value"); + return; + } + if (trans != NULL) { /* It may not actually be necessary to set png_ptr->trans here; * we do it for backward compatibility with the way the png_handle_tRNS @@ -1183,9 +1186,9 @@ { /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ if (png_ptr != NULL) png_ptr->asm_flags = 0; - asm_flags = asm_flags; /* Quiet the compiler */ + PNG_UNUSED(asm_flags) /* Quiet the compiler */ } /* This function was added to libpng 1.2.0 */ void PNGAPI @@ -1196,10 +1199,10 @@ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ if (png_ptr == NULL) return; /* Quiet the compiler */ - mmx_bitdepth_threshold = mmx_bitdepth_threshold; - mmx_rowbytes_threshold = mmx_rowbytes_threshold; + PNG_UNUSED(mmx_bitdepth_threshold) + PNG_UNUSED(mmx_rowbytes_threshold) } #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED diff -ru4NwbB libpng-1.2.50/pngtest.c libpng-1.2.51rc03/pngtest.c --- libpng-1.2.50/pngtest.c 2012-07-09 19:36:57.029655156 -0500 +++ libpng-1.2.51rc03/pngtest.c 2014-02-03 09:56:42.457249666 -0600 @@ -381,9 +381,9 @@ static void pngtest_flush(png_structp png_ptr) { /* Do nothing; fflush() is said to be just a waste of energy. */ - png_ptr = png_ptr; /* Stifle compiler warning */ + PNG_UNUSED(png_ptr) /* Stifle compiler warning */ } #endif /* This is the function that does the actual writing of data. If you are diff -ru4NwbB libpng-1.2.50/pngwrite.c libpng-1.2.51rc03/pngwrite.c --- libpng-1.2.50/pngwrite.c 2012-07-09 19:36:57.057166871 -0500 +++ libpng-1.2.51rc03/pngwrite.c 2014-02-03 09:56:42.485110206 -0600 @@ -1585,9 +1585,9 @@ /* It is REQUIRED to call this to finish writing the rest of the file */ png_write_end(png_ptr, info_ptr); - transforms = transforms; /* Quiet compiler warnings */ - params = params; + PNG_UNUSED(transforms) /* Quiet compiler warnings */ + PNG_UNUSED(params) } #endif #endif /* PNG_WRITE_SUPPORTED */ diff -ru4NwbB libpng-1.2.50/projects/xcode/libpng.xcodeproj/project.pbxproj libpng-1.2.51rc03/projects/xcode/libpng.xcodeproj/project.pbxproj --- libpng-1.2.50/projects/xcode/libpng.xcodeproj/project.pbxproj 2012-07-09 19:36:58.112649000 -0500 +++ libpng-1.2.51rc03/projects/xcode/libpng.xcodeproj/project.pbxproj 2014-02-03 09:56:43.594348505 -0600 @@ -221,9 +221,9 @@ buildSettings = { COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_CURRENT_VERSION = 3; - FRAMEWORK_VERSION = 1.2.50; + FRAMEWORK_VERSION = 1.2.51rc03; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; @@ -239,9 +239,9 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_CURRENT_VERSION = 3; - FRAMEWORK_VERSION = 1.2.50; + FRAMEWORK_VERSION = 1.2.51rc03; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks";