Compare commits

..

9 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
76a1f4bb3f [libpng17] Imported from libpng-1.7.0beta86.tar 2016-12-29 07:58:43 -06:00
Glenn Randers-Pehrson
243d4e5f3f [libpng17] Fixed a potential null pointer dereference in png_set_text_2()
(bug report and patch by Patrick Keshishian)
2016-12-29 07:57:58 -06:00
Glenn Randers-Pehrson
48f8ca26e4 [libpng17] Bump version to 1.7.0beta86 2016-12-29 07:56:24 -06:00
Glenn Randers-Pehrson
6c9ecd348d [libpng17] Removed clutter 2016-12-28 06:13:59 -06:00
Glenn Randers-Pehrson
e6470a8876 [libpng17] Ported new ARM support in CMakeLists.txt from libpng16 2016-12-27 11:35:56 -06:00
John Bowler
b14987b483 Merge branch 'libpng17' of ../../libpng into libpng17 2016-12-27 08:24:04 -08:00
John Bowler
5a1f75289e Merge branch 'libpng17' of ../../libpng into libpng17 2016-12-26 18:04:54 -08:00
John Bowler
512336676e Remove 'defined' within macro
This eliminates the use of 'defined' within macros that get substituted
on #if lines; see the previous patch for a more detailed discussion.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-12-26 16:46:30 -08:00
John Bowler
0ea7a09ced Remove 'defined' within macro
This removes the use of a macro containing the pre-processor 'defined'
operator.  It is unclear whether this is valid; a macro which
"generates" 'defined' is not permitted, but the use of the work
"generates" within the C90 standard seems to imply more than simple
substitution of an expression itself containing a well-formed defined
operation.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-12-26 16:45:31 -08:00
21 changed files with 71 additions and 257 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.7.0beta86 - December 27, 2016
Libpng 1.7.0beta86 - December 29, 2016
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@@ -1418,7 +1418,10 @@ Version 1.7.0beta85 [December 27, 2016]
substitution of an expression itself containing a well-formed defined
operation.
Version 1.7.0beta86 [December 27, 2016]
Version 1.7.0beta86 [December 29, 2016]
Ported CMakeLists.txt from libpng-1.6.27rc01.
Fixed a potential null pointer dereference in png_set_text_2() (bug report
and patch by Patrick Keshishian).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@@ -5718,7 +5718,10 @@ Version 1.7.0beta85 [December 27, 2016]
substitution of an expression itself containing a well-formed defined
operation.
Version 1.7.0beta86 [December 27, 2016]
Version 1.7.0beta86 [December 29, 2016]
Ported CMakeLists.txt from libpng-1.6.27rc01.
Fixed a potential null pointer dereference in png_set_text_2() (bug report
and patch by Patrick Keshishian).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@@ -5,6 +5,7 @@
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012
# Revised by Roger Leigh, 2016
# Revised by Andreas Franek, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
@@ -69,6 +70,35 @@ option(PNGARG "Disable ANSI-C prototypes" OFF)
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
# set definitions and sources for arm
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
check: (default) use internal checking code;
off: disable the optimizations;
on: turn on unconditionally.")
set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS
${PNG_ARM_NEON_POSSIBLE_VALUES})
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
if(index EQUAL -1)
message(FATAL_ERROR
" PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
elseif(NOT ${PNG_ARM_NEON} STREQUAL "no")
set(libpng_arm_sources
arm/arm_init.c
arm/filter_neon.S
arm/filter_neon_intrinsics.c)
if(${PNG_ARM_NEON} STREQUAL "on")
add_definitions(-DPNG_ARM_NEON_OPT=2)
elseif(${PNG_ARM_NEON} STREQUAL "check")
add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED)
endif()
else()
add_definitions(-DPNG_ARM_NEON_OPT=0)
endif()
endif()
# SET LIBNAME
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
@@ -360,6 +390,7 @@ set(libpng_sources
pngwrite.c
pngwtran.c
pngwutil.c
${libpng_arm_sources}
)
set(pngtest_sources
pngtest.c

View File

@@ -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.0beta86, December 27, 2016, are
libpng versions 1.0.7, July 1, 2000, through 1.7.0beta86, December 29, 2016, are
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
@@ -109,4 +109,4 @@ the additional disclaimers inserted at version 1.0.7.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
December 27, 2016
December 29, 2016

2
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.7.0beta86 - December 27, 2016 (shared library 17.0)
README for libpng version 1.7.0beta86 - December 29, 2016 (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.

View File

@@ -3,7 +3,7 @@
*
* Copyright (c) 2013-2016 John Cunningham Bowler
*
* Last changed in libpng 1.6.24 [(PENDING RELEASE)]
* Last changed in libpng 1.6.24 [August 4, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
* Last changed in libpng 1.6.27 [(PENDING RELEASE)]
* Last changed in libpng 1.6.27 [December 29, 2016]
* Copyright (c) 2014-2016 John Cunningham Bowler
*
* This code is released under the libpng license.

View File

@@ -23,4 +23,5 @@ ORIGINAL AUTHORS
of the people below claim any rights with regard to the contents of this
directory.
John Bowler <jbowler@acm.org>
John Bowler <jbowler at acm.org>
Glenn Randers-Pehrson <glennrp at users.sourceforge.net>

View File

@@ -2,7 +2,7 @@
*
* Copyright (c) 2016 John Cunningham Bowler
*
* Last changed in libpng 1.6.24 [(PENDING RELEASE)]
* Last changed in libpng 1.6.24 [August 4, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@@ -1,225 +0,0 @@
png_decompress_chunk(png_structrp png_ptr,
png_uint_32 chunklength, png_uint_32 prefix_size,
png_alloc_size_t *newlength /* must be initialized to the maximum! */,
int terminate /*add a '\0' to the end of the uncompressed data*/)
{
/* TODO: implement different limits for different types of chunk.
*
* The caller supplies *newlength set to the maximum length of the
* uncompressed data, but this routine allocates space for the prefix and
* maybe a '\0' terminator too. We have to assume that 'prefix_size' is
* limited only by the maximum chunk size.
*/
png_alloc_size_t limit = PNG_SIZE_MAX;
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_malloc_max > 0 &&
png_ptr->user_chunk_malloc_max < limit)
limit = png_ptr->user_chunk_malloc_max;
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
limit = PNG_USER_CHUNK_MALLOC_MAX;
# endif
if (limit >= prefix_size + (terminate != 0))
{
int ret;
limit -= prefix_size + (terminate != 0);
if (limit < *newlength)
*newlength = limit;
/* Now try to claim the stream. */
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
if (ret == Z_OK)
{
png_uint_32 lzsize = chunklength - prefix_size;
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
/* input: */ png_ptr->read_buffer + prefix_size, &lzsize,
/* output: */ NULL, newlength);
if (ret == Z_STREAM_END)
{
/* Use 'inflateReset' here, not 'inflateReset2' because this
* preserves the previously decided window size (otherwise it would
* be necessary to store the previous window size.) In practice
* this doesn't matter anyway, because png_inflate will call inflate
* with Z_FINISH in almost all cases, so the window will not be
* maintained.
*/
if (inflateReset(&png_ptr->zstream) == Z_OK)
{
/* Because of the limit checks above we know that the new,
* expanded, size will fit in a size_t (let alone an
* png_alloc_size_t). Use png_malloc_base here to avoid an
* extra OOM message.
*/
png_alloc_size_t new_size = *newlength;
png_alloc_size_t buffer_size = prefix_size + new_size +
(terminate != 0);
png_bytep text = png_voidcast(png_bytep, png_malloc_base(png_ptr,
buffer_size));
if (text != NULL)
{
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
png_ptr->read_buffer + prefix_size, &lzsize,
text + prefix_size, newlength);
if (ret == Z_STREAM_END)
{
if (new_size == *newlength)
{
if (terminate != 0)
text[prefix_size + *newlength] = 0;
if (prefix_size > 0)
memcpy(text, png_ptr->read_buffer, prefix_size);
{
png_bytep old_ptr = png_ptr->read_buffer;
png_ptr->read_buffer = text;
png_ptr->read_buffer_size = buffer_size;
text = old_ptr; /* freed below */
}
}
else
{
/* The size changed on the second read, there can be no
* guarantee that anything is correct at this point.
* The 'msg' pointer has been set to "unexpected end of
* LZ stream", which is fine, but return an error code
* that the caller won't accept.
*/
ret = PNG_UNEXPECTED_ZLIB_RETURN;
}
}
else if (ret == Z_OK)
ret = PNG_UNEXPECTED_ZLIB_RETURN; /* for safety */
/* Free the text pointer (this is the old read_buffer on
* success)
*/
png_free(png_ptr, text);
/* This really is very benign, but it's still an error because
* the extra space may otherwise be used as a Trojan Horse.
*/
if (ret == Z_STREAM_END &&
chunklength - prefix_size != lzsize)
png_chunk_benign_error(png_ptr, "extra compressed data");
}
else
{
/* Out of memory allocating the buffer */
ret = Z_MEM_ERROR;
png_zstream_error(&png_ptr->zstream, Z_MEM_ERROR);
}
}
else
{
/* inflateReset failed, store the error message */
png_zstream_error(&png_ptr->zstream, ret);
if (ret == Z_STREAM_END)
ret = PNG_UNEXPECTED_ZLIB_RETURN;
}
}
else if (ret == Z_OK)
ret = PNG_UNEXPECTED_ZLIB_RETURN;
/* Release the claimed stream */
png_ptr->zowner = 0;
}
else /* the claim failed */ if (ret == Z_STREAM_END) /* impossible! */
ret = PNG_UNEXPECTED_ZLIB_RETURN;
return ret;
}
else
{
/* Application/configuration limits exceeded */
png_zstream_error(&png_ptr->zstream, Z_MEM_ERROR);
return Z_MEM_ERROR;
}
}
#endif /* READ_COMPRESSED_TEXT */
#ifdef PNG_READ_iCCP_SUPPORTED
/* Perform a partial read and decompress, producing 'avail_out' bytes and
* reading from the current chunk as required.
*/
static int
png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
png_uint_32p chunk_bytes, png_bytep next_out, png_alloc_size_t *out_size,
int finish)
{
if (png_ptr->zowner == png_ptr->chunk_name)
{
int ret;
/* next_in and avail_in must have been initialized by the caller. */
png_ptr->zstream.next_out = next_out;
png_ptr->zstream.avail_out = 0; /* set in the loop */
do
{
if (png_ptr->zstream.avail_in == 0)
{
if (read_size > *chunk_bytes)
read_size = (uInt)*chunk_bytes;
*chunk_bytes -= read_size;
if (read_size > 0)
png_crc_read(png_ptr, read_buffer, read_size);
png_ptr->zstream.next_in = read_buffer;
png_ptr->zstream.avail_in = read_size;
}
if (png_ptr->zstream.avail_out == 0)
{
uInt avail = ZLIB_IO_MAX;
if (avail > *out_size)
avail = (uInt)*out_size;
*out_size -= avail;
png_ptr->zstream.avail_out = avail;
}
/* Use Z_SYNC_FLUSH when there is no more chunk data to ensure that all
* the available output is produced; this allows reading of truncated
* streams.
*/
ret = inflate(&png_ptr->zstream,
*chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH :
Z_SYNC_FLUSH));
}
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
*out_size += png_ptr->zstream.avail_out;
png_ptr->zstream.avail_out = 0; /* Should not be required, but is safe */
/* Ensure the error message pointer is always set: */
png_zstream_error(&png_ptr->zstream, ret);
return ret;
}
else
{
png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed");
return Z_STREAM_ERROR;
}
}
#endif /* READ_iCCP */

View File

@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.7.0beta86 - December 27, 2016
libpng version 1.7.0beta86 - December 29, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
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.0beta86 - December 27, 2016
libpng versions 0.97, January 1998, through 1.7.0beta86 - December 29, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson

View File

@@ -1,4 +1,4 @@
.TH LIBPNG 3 "December 27, 2016"
.TH LIBPNG 3 "December 29, 2016"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta86
.SH SYNOPSIS
@@ -500,7 +500,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.0beta86 - December 27, 2016
libpng version 1.7.0beta86 - December 29, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2015 Glenn Randers-Pehrson
@@ -511,7 +511,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.7.0beta86 - December 27, 2016
libpng versions 0.97, January 1998, through 1.7.0beta86 - December 29, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson
@@ -6021,7 +6021,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.7.0beta86 - December 27, 2016:
Libpng version 1.7.0beta86 - December 29, 2016:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6046,7 +6046,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000, through 1.7.0beta86, December 27, 2016, are
libpng versions 1.0.7, July 1, 2000, through 1.7.0beta86, December 29, 2016, are
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
@@ -6145,7 +6145,7 @@ the additional disclaimers inserted at version 1.0.7.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
December 27, 2016
December 29, 2016
.\" end of man page

View File

@@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "December 27, 2016"
.TH LIBPNGPF 3 "December 29, 2016"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta86
(private functions)

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "December 27, 2016"
.TH PNG 5 "December 29, 2016"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

5
png.c
View File

@@ -427,6 +427,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
png_free(png_ptr, info_ptr->text);
info_ptr->text = NULL;
info_ptr->num_text = 0;
info_ptr->max_text = 0;
}
}
#endif
@@ -704,14 +705,14 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.7.0beta86 - December 27, 2016" PNG_STRING_NEWLINE \
"libpng version 1.7.0beta86 - December 29, 2016" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2016 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.0beta86 - December 27, 2016\
return "libpng version 1.7.0beta86 - December 29, 2016\
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";

10
png.h
View File

@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.7.0beta86, December 27, 2016
* libpng version 1.7.0beta86, December 29, 2016
*
* Copyright (c) 1998-2002,2004,2006-2016 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.0beta86, December 27, 2016:
* libpng versions 0.97, January 1998, through 1.7.0beta86, December 29, 2016:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,7 +25,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.0.7, July 1, 2000, through 1.7.0beta86, December 27, 2016, are
* libpng versions 1.0.7, July 1, 2000, through 1.7.0beta86, December 29, 2016, are
* Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
@@ -217,7 +217,7 @@
* Y2K compliance in libpng:
* =========================
*
* December 27, 2016
* December 29, 2016
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@@ -286,7 +286,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.7.0beta86"
#define PNG_HEADER_VERSION_STRING " libpng version 1.7.0beta86 - December 27, 2016\n"
#define PNG_HEADER_VERSION_STRING " libpng version 1.7.0beta86 - December 29, 2016\n"
#define PNG_LIBPNG_VER_SONUM 17
#define PNG_LIBPNG_VER_DLLNUM 17

View File

@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.7.0beta86, December 27, 2016
* libpng version 1.7.0beta86, December 29, 2016
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@@ -1,7 +1,7 @@
VisualStudio instructions
libpng version 1.7.0beta86 - December 27, 2016
libpng version 1.7.0beta86 - December 29, 2016
Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson

View File

@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.7.0beta86 - December 27, 2016
* libpng version 1.7.0beta86 - December 29, 2016
*
* Copyright (c) 2011,2013,2014 Glenn Randers-Pehrson
*

View File

@@ -1,5 +1,5 @@
Makefiles for libpng version 1.7.0beta86 - December 27, 2016
Makefiles for libpng version 1.7.0beta86 - December 29, 2016
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile

View File

@@ -2,7 +2,7 @@
/* pnglibconf.h - library build configuration */
/* libpng version 1.7.0beta86, December 27, 2016 */
/* libpng version 1.7.0beta86, December 29, 2016 */
/* Copyright (c) 1998-2016 Glenn Randers-Pehrson */