Binary files libpng-1.2.24/contrib/gregbook/toucan.png and libpng-1.2.25beta03/contrib/gregbook/toucan.png differ diff -ru4N libpng-1.2.24/png.h libpng-1.2.25beta03/png.h --- libpng-1.2.24/png.h Fri Dec 14 10:22:29 2007 +++ libpng-1.2.25beta03/png.h Mon Jan 21 21:07:18 2008 @@ -1,9 +1,9 @@ /* png.h - header file for PNG reference library * * libpng version %VER% - %DATE% - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) * * Authors and maintainers: @@ -174,8 +174,9 @@ * 1.2.23 13 10223 12.so.0.23[.0] * 1.2.24beta01-02 13 10224 12.so.0.24[.0] * 1.2.24rc01 13 10224 12.so.0.24[.0] * 1.2.24 13 10224 12.so.0.24[.0] + * 1.2.25beta01-03 13 10225 12.so.0.25[.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 @@ -204,9 +205,9 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * * libpng versions 1.2.6, August 15, 2004, through %VER%, %DATE%, are - * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are + * Copyright (c) 2004, 2006-2008 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 -ru4N libpng-1.2.24/pngconf.h libpng-1.2.25beta03/pngconf.h --- libpng-1.2.24/pngconf.h Fri Dec 14 10:22:29 2007 +++ libpng-1.2.25beta03/pngconf.h Mon Jan 21 21:07:18 2008 @@ -2,9 +2,9 @@ /* pngconf.h - machine configurable file for libpng * * libpng version %VER% - %DATE% * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) */ diff -ru4N libpng-1.2.24/pngpread.c libpng-1.2.25beta03/pngpread.c --- libpng-1.2.24/pngpread.c Fri Dec 14 10:22:30 2007 +++ libpng-1.2.25beta03/pngpread.c Mon Jan 21 21:07:18 2008 @@ -1,10 +1,10 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.2.23 [November 6, 2007] + * Last changed in libpng 1.2.25 [%DATE%] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) */ @@ -27,9 +27,9 @@ void PNGAPI png_process_data(png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size) { - if(png_ptr == NULL) return; + if(png_ptr == NULL || info_ptr == NULL) return; png_push_restore_buffer(png_ptr, buffer, buffer_size); while (png_ptr->buffer_size) { @@ -1516,11 +1516,11 @@ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); } } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + else #endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } else diff -ru4N libpng-1.2.24/pngread.c libpng-1.2.25beta03/pngread.c --- libpng-1.2.24/pngread.c Wed Jan 9 10:56:17 2008 +++ libpng-1.2.25beta03/pngread.c Mon Jan 21 21:07:18 2008 @@ -1,10 +1,10 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.24 [December 14, 2007] + * Last changed in libpng 1.2.25 [%DATE%] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) * * This file contains routines that an application calls directly to @@ -88,14 +88,20 @@ #endif png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - i=0; - do + if(user_png_ver) { - if(user_png_ver[i] != png_libpng_ver[i]) + i=0; + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } + else png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) { /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so @@ -317,9 +323,9 @@ */ void PNGAPI png_read_info(png_structp png_ptr, png_infop info_ptr) { - if(png_ptr == NULL) return; + if(png_ptr == NULL || info_ptr == NULL) return; png_debug(1, "in png_read_info\n"); /* If we haven't checked all of the PNG signature bytes, do so now. */ if (png_ptr->sig_bytes < 8) { @@ -1111,8 +1117,10 @@ free_fn = png_ptr->free_fn; mem_ptr = png_ptr->mem_ptr; #endif } + else + return; if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; diff -ru4N libpng-1.2.24/pngrtran.c libpng-1.2.25beta03/pngrtran.c --- libpng-1.2.24/pngrtran.c Fri Dec 14 10:22:31 2007 +++ libpng-1.2.25beta03/pngrtran.c Mon Jan 21 21:07:18 2008 @@ -1,10 +1,10 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.22 [October 13, 2007] + * Last changed in libpng 1.2.25 [%DATE%] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) * * This file contains functions optionally called by an application @@ -963,8 +963,16 @@ palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } } + /* Prevent the transformations being done again, and make sure + * that the now spurious alpha channel is stripped - the code + * has just reduced background composition and gamma correction + * to a simply alpha channel strip. + */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations &= ~PNG_GAMMA; + png_ptr->transformations |= PNG_STRIP_ALPHA; } /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ else /* color_type != PNG_COLOR_TYPE_PALETTE */ @@ -1037,8 +1045,11 @@ palette[i].red = png_ptr->gamma_table[palette[i].red]; palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } + + /* Done the gamma correction. */ + png_ptr->transformations &= ~PNG_GAMMA; } } #if defined(PNG_READ_BACKGROUND_SUPPORTED) else @@ -1074,8 +1085,12 @@ png_composite(palette[i].blue, palette[i].blue, png_ptr->trans[i], back.blue); } } + + /* Handled alpha, still need to strip the channel. */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations |= PNG_STRIP_ALPHA; } #endif /* PNG_READ_BACKGROUND_SUPPORTED */ #if defined(PNG_READ_SHIFT_SUPPORTED) diff -ru4N libpng-1.2.24/pngrutil.c libpng-1.2.25beta03/pngrutil.c --- libpng-1.2.24/pngrutil.c Fri Dec 14 10:22:31 2007 +++ libpng-1.2.25beta03/pngrutil.c Mon Jan 21 21:07:18 2008 @@ -1,10 +1,10 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.23 [November 6, 2007] + * Last changed in libpng 1.2.25 [%DATE%] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) * * This file contains routines that are only called from within @@ -229,9 +229,9 @@ /* Copy what we can of the error message into the text chunk */ text_size = (png_size_t)(chunklength - (text - chunkdata) - 1); text_size = png_sizeof(msg) > text_size ? text_size : png_sizeof(msg); - png_memcpy(text + prefix_size, msg, text_size + 1); + png_memcpy(text + prefix_size, msg, text_size); break; } if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) { @@ -1791,9 +1791,9 @@ } #else #ifdef PNG_FIXED_POINT_SUPPORTED sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); - if (swidth == NULL) + if (sheight == NULL) { png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); return; } @@ -2248,11 +2248,11 @@ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); } } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + else #endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } else diff -ru4N libpng-1.2.24/pngset.c libpng-1.2.25beta03/pngset.c --- libpng-1.2.24/pngset.c Wed Jan 9 10:52:34 2008 +++ libpng-1.2.25beta03/pngset.c Mon Jan 21 21:07:18 2008 @@ -1,10 +1,10 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.24 [December 14, 2007] + * Last changed in libpng 1.2.25 [%DATE%] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * 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.) * * The functions here are used during reads to store data from the file @@ -487,8 +487,9 @@ if (info_ptr->scal_s_width == NULL) { png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + return; } png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); length = png_strlen(sheight) + 1; @@ -498,11 +499,11 @@ { png_free (png_ptr, info_ptr->scal_s_width); png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + return; } png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); - info_ptr->valid |= PNG_INFO_sCAL; #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_SCAL; #endif @@ -982,8 +983,9 @@ if (to->name == NULL) { png_warning(png_ptr, "Out of memory while processing sPLT chunk"); + continue; } png_memcpy(to->name, from->name, length); to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, from->nentries * png_sizeof(png_sPLT_entry)); @@ -992,8 +994,9 @@ png_warning(png_ptr, "Out of memory while processing sPLT chunk"); png_free(png_ptr,to->name); to->name = NULL; + continue; } png_memcpy(to->entries, from->entries, from->nentries * png_sizeof(png_sPLT_entry)); to->nentries = from->nentries;