[libpng16] Detect wrong libpng versions linked to pngdeflate, which currently
only works with libpng versions that can be made to reliably fail when the deflate data contains an out-of-window reference. This means only 1.6 and later. Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning message which it is easier to work round than ignore.
This commit is contained in:
parent
62c6fbbd29
commit
294d0b8408
6
ANNOUNCE
6
ANNOUNCE
@ -58,6 +58,12 @@ Version 1.6.3beta05 [May 8, 2013]
|
||||
Added fixitxt and pngdeflate to the built programs and removed warnings
|
||||
from the source code and timepng that are revealed as a result. Fixed
|
||||
fixitxt when the chunk length is more than 65535 (untested, no test case).
|
||||
Detect wrong libpng versions linked to pngdeflate, which currently
|
||||
only works with libpng versions that can be made to reliably fail when
|
||||
the deflate data contains an out-of-window reference. This means only
|
||||
1.6 and later.
|
||||
Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
|
||||
message which it is easier to work round than ignore.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
6
CHANGES
6
CHANGES
@ -4541,6 +4541,12 @@ Version 1.6.3beta05 [May 8, 2013]
|
||||
Added fixitxt and pngdeflate to the built programs and removed warnings
|
||||
from the source code and timepng that are revealed as a result. Fixed
|
||||
fixitxt when the chunk length is more than 65535 (untested, no test case).
|
||||
Detect wrong libpng versions linked to pngdeflate, which currently
|
||||
only works with libpng versions that can be made to reliably fail when
|
||||
the deflate data contains an out-of-window reference. This means only
|
||||
1.6 and later.
|
||||
Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
|
||||
message which it is easier to work round than ignore.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -252,7 +252,7 @@ int main(int argc, char **argv)
|
||||
|
||||
while (fgets(filename, FILENAME_MAX+1, stdin))
|
||||
{
|
||||
int len = strlen(filename);
|
||||
size_t len = strlen(filename);
|
||||
|
||||
if (filename[len-1] == '\n')
|
||||
{
|
||||
|
@ -13,13 +13,47 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <png.h>
|
||||
/* Define the following to use this program against your installed libpng,
|
||||
* rather than the one being built here:
|
||||
*/
|
||||
#ifdef PNG_FREESTANDING_TESTS
|
||||
# include <png.h>
|
||||
#else
|
||||
# include "../../png.h"
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10600 /* 1.6.0 */
|
||||
# error pngdeflate will not work with libpng versions prior to 1.6
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef PNG_MAXIMUM_INFLATE_WINDOW
|
||||
# if PNG_LIBPNG_VER != 10600 && PNG_LIBPNG_VER != 10601 && \
|
||||
PNG_LIBPNG_VER != 10602
|
||||
# error pngdeflate not supported in this libpng version
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Copied from pngpriv.h */
|
||||
#ifdef __cplusplus
|
||||
# define png_voidcast(type, value) static_cast<type>(value)
|
||||
# define png_constcast(type, value) const_cast<type>(value)
|
||||
# define png_aligncast(type, value) \
|
||||
static_cast<type>(static_cast<void*>(value))
|
||||
# define png_aligncastconst(type, value) \
|
||||
static_cast<type>(static_cast<const void*>(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))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static int idat_error = 0;
|
||||
static int verbose = 0;
|
||||
static int errors = 0;
|
||||
@ -204,8 +238,8 @@ read_png(FILE *fp)
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = malloc(rowbytes);
|
||||
display = malloc(rowbytes);
|
||||
row = png_voidcast(png_byte*, malloc(rowbytes));
|
||||
display = png_voidcast(png_byte*, malloc(rowbytes));
|
||||
|
||||
if (row == NULL || display == NULL)
|
||||
png_error(png_ptr, "OOM allocating row buffers");
|
||||
@ -524,11 +558,10 @@ fix_one(FILE *fp, FILE *fpIn, IDAT_info *info, png_uint_32 max_IDAT, int strip)
|
||||
{
|
||||
rx(fpIn, info->header + state, 1);
|
||||
wx(fp, info->header + state, 1);
|
||||
++state;
|
||||
++len_IDAT;
|
||||
--len;
|
||||
|
||||
if (state == 2)
|
||||
if (state++ == 1)
|
||||
{
|
||||
/* The zlib stream is used to validate the compressed IDAT
|
||||
* data in the most relaxed way possible.
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
||||
* Last changed in libpng 1.6.3 [(PENDING RELEASE)]
|
||||
* 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.)
|
||||
|
Loading…
Reference in New Issue
Block a user