diff -ru4NwbB libpng-1.2.34/example.c libpng-1.2.35beta03/example.c --- libpng-1.2.34/example.c 2008-12-22 12:51:04.701668709 -0600 +++ libpng-1.2.35beta03/example.c 2009-02-05 23:04:45.914029140 -0600 @@ -1,11 +1,11 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.2.33 [October 31, 2008] + * Last changed in libpng 1.2.35 [February 6, 2009] * This file has been placed in the public domain by the authors. - * Maintained 1998-2008 Glenn Randers-Pehrson + * Maintained 1998-2009 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -341,13 +341,15 @@ /* The easiest way to read the image: */ png_bytep row_pointers[height]; + /* Clear the pointer array */ + for (row = 0; row < height; row++) + row_pointers[row] = NULL; + for (row = 0; row < height; row++) - { row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); - } /* Now it's time to read the image. One of these methods is REQUIRED */ #ifdef entire /* Read the entire image in one go */ png_read_image(png_ptr, row_pointers); @@ -770,12 +772,10 @@ png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); /* If you are only writing one row at a time, this works */ for (y = 0; y < height; y++) - { png_write_rows(png_ptr, &row_pointers[y], 1); } - } #endif no_entire /* use only one output method */ /* You can write optional chunks like tEXt, zTXt, and tIME at the end * as well. Shouldn't be necessary in 1.1.0 and up as all the public diff -ru4NwbB libpng-1.2.34/png.h libpng-1.2.35beta03/png.h --- libpng-1.2.34/png.h 2008-12-18 05:45:16.330746499 -0600 +++ libpng-1.2.35beta03/png.h 2009-02-05 23:04:45.898064218 -0600 @@ -1,8 +1,8 @@ /* png.h - header file for PNG reference library * * libpng version 1.2.35beta03 - February 6, 2009 - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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.) * * Authors and maintainers: @@ -216,8 +216,9 @@ * 1.0.42rc01 10 10042 10.so.0.42[.0] * 1.2.34rc01 13 10234 12.so.0.34[.0] * 1.0.42 10 10042 10.so.0.42[.0] * 1.2.34 13 10234 12.so.0.34[.0] + * 1.2.35beta01-03 13 10235 12.so.0.35[.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 diff -ru4NwbB libpng-1.2.34/pngconf.h libpng-1.2.35beta03/pngconf.h --- libpng-1.2.34/pngconf.h 2008-12-18 05:45:16.339349374 -0600 +++ libpng-1.2.35beta03/pngconf.h 2009-02-05 23:04:45.906556606 -0600 @@ -2,9 +2,9 @@ /* pngconf.h - machine configurable file for libpng * * libpng version 1.2.35beta03 - February 6, 2009 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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.) */ diff -ru4NwbB libpng-1.2.34/pngget.c libpng-1.2.35beta03/pngget.c --- libpng-1.2.34/pngget.c 2008-12-18 05:45:16.370508200 -0600 +++ libpng-1.2.35beta03/pngget.c 2009-02-05 23:04:45.938024594 -0600 @@ -882,9 +882,9 @@ #endif /* ?PNG_1_0_X */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED -/* these functions were added to libpng 1.2.6 */ +/* These functions were added to libpng 1.2.6 */ png_uint_32 PNGAPI png_get_user_width_max (png_structp png_ptr) { return (png_ptr? png_ptr->user_width_max : 0); diff -ru4NwbB libpng-1.2.34/pngread.c libpng-1.2.35beta03/pngread.c --- libpng-1.2.34/pngread.c 2008-12-18 05:45:16.392000603 -0600 +++ libpng-1.2.35beta03/pngread.c 2009-02-05 23:04:45.960347768 -0600 @@ -1,10 +1,10 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.35 [February 6, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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 file contains routines that an application calls directly to @@ -1436,14 +1436,14 @@ info_ptr->height * png_sizeof(png_bytep)); #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ROWS; #endif + png_memset(info_ptr->row_pointers, 0, info_ptr->height + * png_sizeof(png_bytep)); for (row = 0; row < (int)info_ptr->height; row++) - { info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); } - } png_read_image(png_ptr, info_ptr->row_pointers); info_ptr->valid |= PNG_INFO_IDAT; diff -ru4NwbB libpng-1.2.34/pngrtran.c libpng-1.2.35beta03/pngrtran.c --- libpng-1.2.34/pngrtran.c 2008-12-18 05:45:16.409964684 -0600 +++ libpng-1.2.35beta03/pngrtran.c 2009-02-05 23:04:45.979644721 -0600 @@ -1,10 +1,10 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.35 [February 6, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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 file contains functions optionally called by an application @@ -308,11 +308,9 @@ } hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 * png_sizeof(png_dsortp))); - for (i = 0; i < 769; i++) - hash[i] = NULL; -/* png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); */ + png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); num_new_palette = num_palette; /* initial wild guess at how far apart the farthest pixel @@ -4132,8 +4130,10 @@ { double fin, fout; png_uint_32 last, max; + png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); + for (i = 0; i < num; i++) { png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, (png_uint_32)(256 * png_sizeof(png_uint_16))); @@ -4187,8 +4187,10 @@ png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p ))); + png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p)); + for (i = 0; i < num; i++) { png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr, (png_uint_32)(256 * png_sizeof(png_uint_16))); @@ -4210,8 +4212,11 @@ png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p))); + png_memset(png_ptr->gamma_16_from_1, 0, + num * png_sizeof(png_uint_16p)); + for (i = 0; i < num; i++) { png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr, (png_uint_32)(256 * png_sizeof(png_uint_16))); diff -ru4NwbB libpng-1.2.34/pngrutil.c libpng-1.2.35beta03/pngrutil.c --- libpng-1.2.34/pngrutil.c 2008-12-22 10:46:25.365703055 -0600 +++ libpng-1.2.35beta03/pngrutil.c 2009-02-05 23:04:45.992527977 -0600 @@ -3203,11 +3211,11 @@ png_debug1(3, "width = %lu,", png_ptr->width); png_debug1(3, "height = %lu,", png_ptr->height); png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); - png_debug1(3, "num_rows = %lu", png_ptr->num_rows); + png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); - png_debug1(3, "irowbytes = %lu,", png_ptr->irowbytes); + png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes); png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ diff -ru4NwbB libpng-1.2.34/pngset.c libpng-1.2.35beta03/pngset.c --- libpng-1.2.34/pngset.c 2008-12-22 10:46:28.691451710 -0600 +++ libpng-1.2.35beta03/pngset.c 2009-02-05 23:04:46.000483109 -0600 @@ -1,10 +1,10 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.35 [February 6, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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.) * * The functions here are used during reads to store data from the file @@ -60,9 +60,10 @@ info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5); #endif info_ptr->valid |= PNG_INFO_cHRM; } -#endif +#endif /* PNG_FLOATING_POINT_SUPPORTED */ + #ifdef PNG_FIXED_POINT_SUPPORTED void PNGAPI png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, @@ -381,9 +382,13 @@ png_warning(png_ptr, "Insufficient memory for pCAL params."); return; } - info_ptr->pcal_params[nparams] = NULL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif + + png_memset(info_ptr->pcal_params, 0, nparams * png_sizeof(png_color)); for (i = 0; i < nparams; i++) { length = png_strlen(params[i]) + 1; @@ -398,11 +403,8 @@ png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length); } info_ptr->valid |= PNG_INFO_pCAL; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PCAL; -#endif } #endif #if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) @@ -634,9 +636,9 @@ #endif } #endif /* cHRM */ } -#endif +#endif /* sRGB */ #if defined(PNG_iCCP_SUPPORTED) void PNGAPI diff -ru4NwbB libpng-1.2.34/pngtest.c libpng-1.2.35beta03/pngtest.c --- libpng-1.2.34/pngtest.c 2008-12-18 05:45:16.437734816 -0600 +++ libpng-1.2.35beta03/pngtest.c 2009-02-05 23:04:46.009301799 -0600 @@ -1215,9 +1215,9 @@ png_debug1(0, "Writing row data for pass %d", pass); for (y = 0; y < height; y++) { #ifndef SINGLE_ROWBUF_ALLOC - png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y); + png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y); row_buf = (png_bytep)png_malloc(read_ptr, png_get_rowbytes(read_ptr, read_info_ptr)); png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf, png_get_rowbytes(read_ptr, read_info_ptr)); diff -ru4NwbB libpng-1.2.34/pngwio.c libpng-1.2.35beta03/pngwio.c --- libpng-1.2.34/pngwio.c 2008-12-18 05:45:16.453563498 -0600 +++ libpng-1.2.35beta03/pngwio.c 2009-02-05 23:04:46.025401124 -0600 @@ -1,10 +1,10 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.35 [February 6, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 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 file provides a location for all output. Users who need @@ -136,9 +136,9 @@ #endif if (png_ptr == NULL) return; #if !defined(_WIN32_WCE) io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL) + if (io_ptr != NULL && fileno(io_ptr) != -1) fflush(io_ptr); #endif } #endif diff -ru4NwbB libpng-1.2.34/pngwrite.c libpng-1.2.35beta03/pngwrite.c --- libpng-1.2.34/pngwrite.c 2008-12-18 05:45:16.461190176 -0600 +++ libpng-1.2.35beta03/pngwrite.c 2009-02-05 23:04:46.033252903 -0600 @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.2.31 [August 19, 2008] + * Last changed in libpng 1.2.34 [December 18, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 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.)