提交 8da39742 编写于 作者: C Cosmin Truta

[master] Imported from libpng-1.6.35.tar

上级 7292c861
Libpng 1.6.34 - September 29, 2017 Libpng 1.6.35 - July 15, 2018
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production code.
Files available for download: Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux):
"configure" script
libpng-1.6.34.tar.xz (LZMA-compressed, recommended) libpng-1.6.35.tar.xz (LZMA-compressed, recommended)
libpng-1.6.34.tar.gz libpng-1.6.35.tar.gz
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows):
"configure" script
lpng1634.7z (LZMA-compressed, recommended) lp1635.7z (LZMA-compressed, recommended)
lpng1634.zip lp1635.zip
Other information: Other information:
libpng-1.6.34-README.txt libpng-1.6.35-README.txt
libpng-1.6.34-LICENSE.txt libpng-1.6.35-LICENSE.txt
libpng-1.6.34-*.asc (armored detached GPG signatures)
Changes since the last public release (1.6.34):
Changes since the last public release (1.6.33):
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
test failures. failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
Added calls to png_set_*() transforms commonly used by browsers to
the fuzzer.
Removed some unnecessary brackets in pngrtran.c
Fixed miscellaneous typos (Patch by github user "luzpaz").
Change "ASM C" to "C ASM" in CMakeLists.txt
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
Added hardware optimization directories to zip and 7z distributions.
Fixed incorrect bitmask for options.
Fixed many spelling typos.
Make png_get_iCCP consistent with man page (allow compression-type argument
to be NULL, bug report by Lenard Szolnoki).
Replaced the remaining uses of png_size_t with size_t (Cosmin)
Fixed the calculation of row_factor in png_check_chunk_length
(reported by Thuan Pham in SourceForge issue #278)
Added missing parentheses to a macro definition
(suggested by "irwir" in GitHub issue #216)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) to subscribe).
or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
#if 0
CHANGES - changes for libpng CHANGES - changes for libpng
version 0.1 [March 29, 1995] version 0.1 [March 29, 1995]
...@@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004] ...@@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
sequential read support. sequential read support.
Added some "#if PNG_WRITE_SUPPORTED" blocks. Added some "#if PNG_WRITE_SUPPORTED" blocks.
Added #ifdef to remove some redundancy in png_malloc_default(). Added #ifdef to remove some redundancy in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete. Use png_malloc instead of png_zalloc to allocate the palette.
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004] Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS(). Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
...@@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011] ...@@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
old VisualC++ preprocessor. old VisualC++ preprocessor.
Turned on interlace handling in png_read_png(). Turned on interlace handling in png_read_png().
Fixed gcc pendantic warnings. Fixed gcc pedantic warnings.
Handle longjmp in Cygwin. Handle longjmp in Cygwin.
Fixed png_get_current_row_number() in the interlaced case. Fixed png_get_current_row_number() in the interlaced case.
Cleaned up ALPHA flags and transformations. Cleaned up ALPHA flags and transformations.
...@@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011] ...@@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691. was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
optimization configureable. optimization configurable.
IDAT compression failed if preceded by a compressed text chunk (bug IDAT compression failed if preceded by a compressed text chunk (bug
introduced in libpng-1.5.3beta01-02). This was because the attempt to introduced in libpng-1.5.3beta01-02). This was because the attempt to
reset the zlib stream in png_write_IDAT happened after the first IDAT reset the zlib stream in png_write_IDAT happened after the first IDAT
...@@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011] ...@@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01. Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
Version 1.5.6beta06 [October 17, 2011] Version 1.5.6beta06 [October 17, 2011]
Removed two redundant tests for unitialized row. Removed two redundant tests for uninitialized row.
Fixed a relatively harmless memory overwrite in compressed text writing Fixed a relatively harmless memory overwrite in compressed text writing
with a 1 byte zlib buffer. with a 1 byte zlib buffer.
Add ability to call png_read_update_info multiple times to pngvalid.c. Add ability to call png_read_update_info multiple times to pngvalid.c.
...@@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011] ...@@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
crash. The pngmem.c implementation of png_malloc() included a cast crash. The pngmem.c implementation of png_malloc() included a cast
to png_size_t which would fail on large allocations on 16-bit systems. to png_size_t which would fail on large allocations on 16-bit systems.
Fix for the preprocessor of the Intel C compiler. The preprocessor Fix for the preprocessor of the Intel C compiler. The preprocessor
splits adjacent @ signs with a space; this changes the concatentation splits adjacent @ signs with a space; this changes the concatenation
token from @-@-@ to PNG_JOIN; that should work with all compiler token from @-@-@ to PNG_JOIN; that should work with all compiler
preprocessors. preprocessors.
Paeth filter speed improvements from work by Siarhei Siamashka. This Paeth filter speed improvements from work by Siarhei Siamashka. This
...@@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011] ...@@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
gray (on palette) itself. gray (on palette) itself.
Fixes for C++ compilation using g++ When libpng source is compiled Fixes for C++ compilation using g++ When libpng source is compiled
using g++. The compiler imposes C++ rules on the C source; thus it using g++. The compiler imposes C++ rules on the C source; thus it
is desireable to make the source work with either C or C++ rules is desirable to make the source work with either C or C++ rules
without throwing away useful error information. This change adds without throwing away useful error information. This change adds
png_voidcast to allow C semantic (void*) cases or the corresponding png_voidcast to allow C semantic (void*) cases or the corresponding
C++ static_cast operation, as appropriate. C++ static_cast operation, as appropriate.
...@@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012] ...@@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
possible to call png_inflate() incrementally. A warning is no longer possible to call png_inflate() incrementally. A warning is no longer
issued if the language tag or translated keyword in the iTXt chunk issued if the language tag or translated keyword in the iTXt chunk
has zero length. has zero length.
If benign errors are disabled use maximum window on ancilliary inflate. If benign errors are disabled use maximum window on ancillary inflate.
This works round a bug introduced in 1.5.4 where compressed ancillary This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate chunks could end up with a too-small windowBits value in the deflate
header. header.
...@@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012] ...@@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
declared even though the functions are never actually defined. This declared even though the functions are never actually defined. This
change provides a dummy definition so that the declarations work, yet any change provides a dummy definition so that the declarations work, yet any
implementation will fail to compile because of an incomplete type. implementation will fail to compile because of an incomplete type.
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
strcpy() was accidentally re-introduced in libpng16; this change replaces strcpy() was accidentally re-introduced in libpng16; this change replaces
it with strncpy(). it with strncpy().
Eliminated use of png_sizeof(); use sizeof() instead. Eliminated use of png_sizeof(); use sizeof() instead.
...@@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012] ...@@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
resulting in VS2010 having to update the files. resulting in VS2010 having to update the files.
Removed non-working ICC profile support code that was mostly added to Removed non-working ICC profile support code that was mostly added to
libpng-1.6.0beta29 and beta30. There was too much code for too little libpng-1.6.0beta29 and beta30. There was too much code for too little
gain; implementing full ICC color correction may be desireable but is left gain; implementing full ICC color correction may be desirable but is left
up to applications. up to applications.
Version 1.6.0beta32 [November 25, 2012] Version 1.6.0beta32 [November 25, 2012]
...@@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013] ...@@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
the optimizations ('check' vs 'api') are exposed in the public header files the optimizations ('check' vs 'api') are exposed in the public header files
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
decision about whether or not to use the optimizations. decision about whether or not to use the optimizations.
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage. Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
on __ARM_NEON__ from configure time to compile time. This breaks symbol on __ARM_NEON__ from configure time to compile time. This breaks symbol
prefixing because the definition of the special png_init_filter_functions prefixing because the definition of the special png_init_filter_functions
...@@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016] ...@@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
to All and adds a list of the warnings that need to be turned off. This is to All and adds a list of the warnings that need to be turned off. This is
semi-documentary; the intent is to tell libpng users which warnings have semi-documentary; the intent is to tell libpng users which warnings have
been examined and judged non-fixable at present. The warning about been examined and judged non-fixable at present. The warning about
structure padding is fixable, but it would be a signficant change (moving structure padding is fixable, but it would be a significant change (moving
structure members around). structure members around).
Version 1.6.24beta03 [July 4, 2016] Version 1.6.24beta03 [July 4, 2016]
...@@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017] ...@@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017]
Added option to Cmake build allowing a custom location of zlib to be Added option to Cmake build allowing a custom location of zlib to be
specified in a scenario where libpng is being built as a subproject specified in a scenario where libpng is being built as a subproject
alongside zlib by another project (Sam Serrels). alongside zlib by another project (Sam Serrels).
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
up to 16 options. up to 16 options.
Version 1.6.28rc02 [January 4, 2017] Version 1.6.28rc02 [January 4, 2017]
...@@ -5932,7 +5931,7 @@ Version 1.6.32beta04 [August 2, 2017] ...@@ -5932,7 +5931,7 @@ Version 1.6.32beta04 [August 2, 2017]
Update libpng.3 and libpng-manual.txt about eXIf functions. Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017] Version 1.6.32beta05 [August 2, 2017]
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
Version 1.6.32beta06 [August 2, 2017] Version 1.6.32beta06 [August 2, 2017]
Removed png_get_eXIf_1() and png_set_eXIf_1(). Removed png_get_eXIf_1() and png_set_eXIf_1().
...@@ -6038,14 +6037,35 @@ Version 1.6.33 [September 28, 2017] ...@@ -6038,14 +6037,35 @@ Version 1.6.33 [September 28, 2017]
Add end_info structure and png_read_end() to the libpng fuzzer. Add end_info structure and png_read_end() to the libpng fuzzer.
Version 1.6.34 [September 29, 2017] Version 1.6.34 [September 29, 2017]
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused Removed contrib/pngsuite/i*.png; some of them caused test failures.
test failures.
Version 1.6.35beta01 [March 6, 2018]
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
Added calls to png_set_*() transforms commonly used by browsers to
the fuzzer.
Removed some unnecessary brackets in pngrtran.c
Fixed miscellaneous typos (Patch by github user "luzpaz").
Change "ASM C" to "C ASM" in CMakeLists.txt
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
Added hardware optimization directories to zip and 7z distributions.
Fixed incorrect bitmask for options.
Fixed many spelling typos.
Version 1.6.35beta02 [March 28, 2018]
Make png_get_iCCP consistent with man page (allow compression-type argument
to be NULL, bug report by Lenard Szolnoki).
Version 1.6.35 [July 15, 2018]
Replaced the remaining uses of png_size_t with size_t (Cosmin)
Fixed the calculation of row_factor in png_check_chunk_length
(reported by Thuan Pham in SourceForge issue #278)
Added missing parentheses to a macro definition
(suggested by "irwir" in GitHub issue #216)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) to subscribe).
or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
#endif
# CMakeLists.txt # CMakeLists.txt
# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson # Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
# Written by Christian Ehrlicher, 2007 # Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010 # Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012 # Revised by Clifford Yapp, 2011-2012
...@@ -31,12 +31,12 @@ endif(POLICY CMP0054) ...@@ -31,12 +31,12 @@ endif(POLICY CMP0054)
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo") set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
project(libpng ASM C) project(libpng C ASM)
enable_testing() enable_testing()
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6) set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 34) set(PNGLIB_RELEASE 35)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
...@@ -424,7 +424,7 @@ else() ...@@ -424,7 +424,7 @@ else()
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# A single target handles generation of all generated files. If # A single target handles generation of all generated files. If
# they are dependend upon separately by multiple targets, this # they are depended upon separately by multiple targets, this
# confuses parallel make (it would require a separate top-level # confuses parallel make (it would require a separate top-level
# target for each file to track the dependencies properly). # target for each file to track the dependencies properly).
add_custom_target(genfiles DEPENDS add_custom_target(genfiles DEPENDS
...@@ -844,7 +844,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW) ...@@ -844,7 +844,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(png PROPERTIES set_target_properties(png PROPERTIES
# VERSION 16.${PNGLIB_RELEASE}.1.6.34 # VERSION 16.${PNGLIB_RELEASE}.1.6.35
VERSION 16.${PNGLIB_RELEASE}.0 VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16 SOVERSION 16
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
......
...@@ -284,7 +284,7 @@ those sections that are actually used will be loaded into memory. ...@@ -284,7 +284,7 @@ those sections that are actually used will be loaded into memory.
XIV. Enabling or disabling hardware optimizations XIV. Enabling or disabling hardware optimizations
Certain hardware capabilites, such as the Intel SSE instructions, Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options are normally detected at run time. Enable them with configure options
such as one of such as one of
......
...@@ -10,8 +10,8 @@ this sentence. ...@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same 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 disclaimer and license as libpng-1.0.6 with the following individuals
added to the list of Contributing Authors: added to the list of Contributing Authors:
...@@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and ...@@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
September 29, 2017 July 15, 2018
此差异已折叠。
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0) README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
...@@ -118,7 +118,7 @@ development group. ...@@ -118,7 +118,7 @@ development group.
Send comments/corrections/commendations to png-mng-implement at Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net to subscribe).
You can't reach Guy, the original libpng author, at the addresses You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will given in previous versions of this document. He and Andreas will
......
此差异已折叠。
...@@ -194,7 +194,7 @@ case "$mode" in ...@@ -194,7 +194,7 @@ case "$mode" in
if test -d .git if test -d .git
then then
exec >&2 exec >&2
echo "ERROR: running autoreconf on an initialized sytem" echo "ERROR: running autoreconf on an initialized system"
echo " This is not necessary; it is only necessary to remake the" echo " This is not necessary; it is only necessary to remake the"
echo " autotools generated files if Makefile.am or configure.ac" echo " autotools generated files if Makefile.am or configure.ac"
echo " change and make does the right thing with:" echo " change and make does the right thing with:"
......
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
此差异已折叠。
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `feenableexcept' function. */
#undef HAVE_FEENABLEEXCEPT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Turn on ARM Neon optimizations at run-time */
#undef PNG_ARM_NEON_API_SUPPORTED
/* Check for ARM Neon support at run-time */
#undef PNG_ARM_NEON_CHECK_SUPPORTED
/* Enable ARM Neon optimizations */
#undef PNG_ARM_NEON_OPT
/* Enable Intel SSE optimizations */
#undef PNG_INTEL_SSE_OPT
/* Turn on MIPS MSA optimizations at run-time */
#undef PNG_MIPS_MSA_API_SUPPORTED
/* Check for MIPS MSA support at run-time */
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
/* Enable MIPS MSA optimizations */
#undef PNG_MIPS_MSA_OPT
/* Turn on POWERPC VSX optimizations at run-time */
#undef PNG_POWERPC_VSX_API_SUPPORTED
/* Check for POWERPC VSX support at run-time */
#undef PNG_POWERPC_VSX_CHECK_SUPPORTED
/* Enable POWERPC VSX optimizations */
#undef PNG_POWERPC_VSX_OPT
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
#undef restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
previous line. Perhaps some future version of Sun C++ will work with
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
此差异已折叠。
此差异已折叠。
...@@ -25,7 +25,7 @@ AC_PREREQ([2.68]) ...@@ -25,7 +25,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng],[1.6.34],[png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng],[1.6.35],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts]) AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign') # libpng does not follow GNU file name conventions (hence 'foreign')
...@@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway): ...@@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2]) dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.34 PNGLIB_VERSION=1.6.35
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=6 PNGLIB_MINOR=6
PNGLIB_RELEASE=34 PNGLIB_RELEASE=35
dnl End of version number stuff dnl End of version number stuff
......
...@@ -33,7 +33,7 @@ option WRITE_16BIT on ...@@ -33,7 +33,7 @@ option WRITE_16BIT on
option WRITE_FILTER on option WRITE_FILTER on
# pngcp needs this to preserve unknown chunks, switching all these on means that # pngcp needs this to preserve unknown chunks, switching all these on means that
# pngcp can work without explicit known chunk reading suppport # pngcp can work without explicit known chunk reading support
option UNKNOWN_CHUNKS on option UNKNOWN_CHUNKS on
option SET_UNKNOWN_CHUNKS on option SET_UNKNOWN_CHUNKS on
option HANDLE_AS_UNKNOWN on option HANDLE_AS_UNKNOWN on
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* without processing the image. Notice that some header information may occur * without processing the image. Notice that some header information may occur
* after the image data. Textual data and comments are an example; the approach * after the image data. Textual data and comments are an example; the approach
* in this file won't work reliably for such data because it only looks for the * in this file won't work reliably for such data because it only looks for the
* information in the section of the file that preceeds the image data. * information in the section of the file that precedes the image data.
* *
* Compile and link against libpng and zlib, plus anything else required on the * Compile and link against libpng and zlib, plus anything else required on the
* system you use. * system you use.
......
...@@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth, ...@@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
int passes = 1; int passes = 1;
# endif /* !WRITE_INTERLACING */ # endif /* !WRITE_INTERLACING */
int pass; int pass;
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr); size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = malloc(rowbytes); row = malloc(rowbytes);
...@@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result) ...@@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
return 0; return 0;
} }
static png_size_t static size_t
load_fake(png_charp param, png_bytepp profile) load_fake(png_charp param, png_bytepp profile)
{ {
char *endptr = NULL; char *endptr = NULL;
...@@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams, ...@@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
{ {
case '<': case '<':
{ {
png_size_t filelen = load_file(params[1]+1, &profile); size_t filelen = load_file(params[1]+1, &profile);
if (filelen > 0xfffffffc) /* Maximum profile length */ if (filelen > 0xfffffffc) /* Maximum profile length */
{ {
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n", fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
...@@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams, ...@@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
{ {
png_size_t fake_len = load_fake(params[1], &profile); size_t fake_len = load_fake(params[1], &profile);
if (fake_len > 0) /* else a simple parameter */ if (fake_len > 0) /* else a simple parameter */
{ {
...@@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text, ...@@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
{ {
png_bytep data = NULL; png_bytep data = NULL;
png_size_t fake_len = load_fake(param, &data); size_t fake_len = load_fake(param, &data);
if (fake_len > 0) /* else a simple parameter */ if (fake_len > 0) /* else a simple parameter */
{ {
......
...@@ -551,7 +551,7 @@ struct display ...@@ -551,7 +551,7 @@ struct display
png_structp original_pp; /* used on the original read */ png_structp original_pp; /* used on the original read */
png_infop original_ip; /* set by the original read */ png_infop original_ip; /* set by the original read */
png_size_t original_rowbytes; /* of the original rows: */ size_t original_rowbytes; /* of the original rows: */
png_bytepp original_rows; /* from the original read */ png_bytepp original_rows; /* from the original read */
/* Original chunks valid */ /* Original chunks valid */
...@@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename) ...@@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
static void static void
buffer_read(struct display *dp, struct buffer *bp, png_bytep data, buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
png_size_t size) size_t size)
{ {
struct buffer_list *last = bp->current; struct buffer_list *last = bp->current;
size_t read_count = bp->read_count; size_t read_count = bp->read_count;
...@@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data, ...@@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
} }
static void PNGCBAPI static void PNGCBAPI
read_function(png_structp pp, png_bytep data, png_size_t size) read_function(png_structp pp, png_bytep data, size_t size)
{ {
buffer_read(get_dp(pp), get_buffer(pp), data, size); buffer_read(get_dp(pp), get_buffer(pp), data, size);
} }
...@@ -927,7 +927,7 @@ update_display(struct display *dp) ...@@ -927,7 +927,7 @@ update_display(struct display *dp)
png_structp pp; png_structp pp;
png_infop ip; png_infop ip;
/* Now perform the initial read with a 0 tranform. */ /* Now perform the initial read with a 0 transform. */
read_png(dp, &dp->original_file, "original read", 0/*no transform*/); read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
/* Move the result to the 'original' fields */ /* Move the result to the 'original' fields */
...@@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms) ...@@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms)
#ifdef PNG_WRITE_PNG_SUPPORTED #ifdef PNG_WRITE_PNG_SUPPORTED
static void static void
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data, buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
png_size_t size) size_t size)
/* Generic write function used both from the write callback provided to /* Generic write function used both from the write callback provided to
* libpng and from the generic read code. * libpng and from the generic read code.
*/ */
...@@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data, ...@@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
} }
static void PNGCBAPI static void PNGCBAPI
write_function(png_structp pp, png_bytep data, png_size_t size) write_function(png_structp pp, png_bytep data, size_t size)
{ {
buffer_write(get_dp(pp), get_buffer(pp), data, size); buffer_write(get_dp(pp), get_buffer(pp), data, size);
} }
......
...@@ -578,11 +578,11 @@ typedef struct ...@@ -578,11 +578,11 @@ typedef struct
int stride_extra; int stride_extra;
FILE *input_file; FILE *input_file;
png_voidp input_memory; png_voidp input_memory;
png_size_t input_memory_size; size_t input_memory_size;
png_bytep buffer; png_bytep buffer;
ptrdiff_t stride; ptrdiff_t stride;
png_size_t bufsize; size_t bufsize;
png_size_t allocsize; size_t allocsize;
char tmpfile_name[32]; char tmpfile_name[32];
png_uint_16 colormap[256*4]; png_uint_16 colormap[256*4];
} }
...@@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name, ...@@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
static void static void
allocbuffer(Image *image) allocbuffer(Image *image)
{ {
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride); size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
if (size+32 > image->bufsize) if (size+32 > image->bufsize)
{ {
...@@ -1142,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb) ...@@ -1142,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
} }
} }
/* Convertion between pixel formats. The code above effectively eliminates the /* Conversion between pixel formats. The code above effectively eliminates the
* component ordering changes leaving three basic changes: * component ordering changes leaving three basic changes:
* *
* 1) Remove an alpha channel by pre-multiplication or compositing on a * 1) Remove an alpha channel by pre-multiplication or compositing on a
...@@ -2036,7 +2036,7 @@ typedef struct ...@@ -2036,7 +2036,7 @@ typedef struct
/* Precalculated values: */ /* Precalculated values: */
int in_opaque; /* Value of input alpha that is opaque */ int in_opaque; /* Value of input alpha that is opaque */
int is_palette; /* Sample values come from the palette */ int is_palette; /* Sample values come from the palette */
int accumulate; /* Accumlate component errors (don't log) */ int accumulate; /* Accumulate component errors (don't log) */
int output_8bit; /* Output is 8-bit (else 16-bit) */ int output_8bit; /* Output is 8-bit (else 16-bit) */
void (*in_gp)(Pixel*, png_const_voidp); void (*in_gp)(Pixel*, png_const_voidp);
......
...@@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep; ...@@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep;
#define PNG_WRITE_16BIT_SUPPORTED #define PNG_WRITE_16BIT_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED #define PNG_READ_16BIT_SUPPORTED
/* This comes from pnglibconf.h afer 1.5: */ /* This comes from pnglibconf.h after 1.5: */
#define PNG_FP_1 100000 #define PNG_FP_1 100000
#define PNG_GAMMA_THRESHOLD_FIXED\ #define PNG_GAMMA_THRESHOLD_FIXED\
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1)) ((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
......
...@@ -102,7 +102,7 @@ typedef png_byte *png_const_bytep; ...@@ -102,7 +102,7 @@ typedef png_byte *png_const_bytep;
#define PNG_WRITE_16BIT_SUPPORTED #define PNG_WRITE_16BIT_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED #define PNG_READ_16BIT_SUPPORTED
/* This comes from pnglibconf.h afer 1.5: */ /* This comes from pnglibconf.h after 1.5: */
#define PNG_FP_1 100000 #define PNG_FP_1 100000
#define PNG_GAMMA_THRESHOLD_FIXED\ #define PNG_GAMMA_THRESHOLD_FIXED\
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1)) ((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
...@@ -711,7 +711,7 @@ typedef struct png_store_file ...@@ -711,7 +711,7 @@ typedef struct png_store_file
unsigned int IDAT_bits; /* Number of bits in IDAT size */ unsigned int IDAT_bits; /* Number of bits in IDAT size */
png_uint_32 IDAT_size; /* Total size of IDAT data */ png_uint_32 IDAT_size; /* Total size of IDAT data */
png_uint_32 id; /* must be correct (see FILEID) */ png_uint_32 id; /* must be correct (see FILEID) */
png_size_t datacount; /* In this (the last) buffer */ size_t datacount; /* In this (the last) buffer */
png_store_buffer data; /* Last buffer in file */ png_store_buffer data; /* Last buffer in file */
int npalette; /* Number of entries in palette */ int npalette; /* Number of entries in palette */
store_palette_entry* palette; /* May be NULL */ store_palette_entry* palette; /* May be NULL */
...@@ -777,10 +777,10 @@ typedef struct png_store ...@@ -777,10 +777,10 @@ typedef struct png_store
png_infop piread; png_infop piread;
png_store_file* current; /* Set when reading */ png_store_file* current; /* Set when reading */
png_store_buffer* next; /* Set when reading */ png_store_buffer* next; /* Set when reading */
png_size_t readpos; /* Position in *next */ size_t readpos; /* Position in *next */
png_byte* image; /* Buffer for reading interlaced images */ png_byte* image; /* Buffer for reading interlaced images */
png_size_t cb_image; /* Size of this buffer */ size_t cb_image; /* Size of this buffer */
png_size_t cb_row; /* Row size of the image(s) */ size_t cb_row; /* Row size of the image(s) */
uLong IDAT_crc; uLong IDAT_crc;
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */ png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */ png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
...@@ -791,7 +791,7 @@ typedef struct png_store ...@@ -791,7 +791,7 @@ typedef struct png_store
png_store_file* saved; png_store_file* saved;
png_structp pwrite; /* Used when writing a new file */ png_structp pwrite; /* Used when writing a new file */
png_infop piwrite; png_infop piwrite;
png_size_t writepos; /* Position in .new */ size_t writepos; /* Position in .new */
char wname[FILE_NAME_SIZE]; char wname[FILE_NAME_SIZE];
png_store_buffer new; /* The end of the new PNG file being written. */ png_store_buffer new; /* The end of the new PNG file being written. */
store_pool write_memory_pool; store_pool write_memory_pool;
...@@ -1125,7 +1125,7 @@ static png_bytep ...@@ -1125,7 +1125,7 @@ static png_bytep
store_image_row(const png_store* ps, png_const_structp pp, int nImage, store_image_row(const png_store* ps, png_const_structp pp, int nImage,
png_uint_32 y) png_uint_32 y)
{ {
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2; size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
if (ps->image == NULL) if (ps->image == NULL)
png_error(pp, "no allocated image"); png_error(pp, "no allocated image");
...@@ -1160,9 +1160,9 @@ store_image_free(png_store *ps, png_const_structp pp) ...@@ -1160,9 +1160,9 @@ store_image_free(png_store *ps, png_const_structp pp)
static void static void
store_ensure_image(png_store *ps, png_const_structp pp, int nImages, store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
png_size_t cbRow, png_uint_32 cRows) size_t cbRow, png_uint_32 cRows)
{ {
png_size_t cb = nImages * cRows * (cbRow + 5); size_t cb = nImages * cRows * (cbRow + 5);
if (ps->cb_image < cb) if (ps->cb_image < cb)
{ {
...@@ -1234,7 +1234,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage) ...@@ -1234,7 +1234,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
png_error(pp, "image overwrite"); png_error(pp, "image overwrite");
else else
{ {
png_size_t cbRow = ps->cb_row; size_t cbRow = ps->cb_row;
png_uint_32 rows = ps->image_h; png_uint_32 rows = ps->image_h;
image += iImage * (cbRow+5) * ps->image_h; image += iImage * (cbRow+5) * ps->image_h;
...@@ -1278,7 +1278,7 @@ valid_chunktype(png_uint_32 chunktype) ...@@ -1278,7 +1278,7 @@ valid_chunktype(png_uint_32 chunktype)
} }
static void PNGCBAPI static void PNGCBAPI
store_write(png_structp ppIn, png_bytep pb, png_size_t st) store_write(png_structp ppIn, png_bytep pb, size_t st)
{ {
png_const_structp pp = ppIn; png_const_structp pp = ppIn;
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp)); png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
...@@ -1346,13 +1346,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st) ...@@ -1346,13 +1346,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
else /* chunkpos >= 8 */ else /* chunkpos >= 8 */
{ {
png_size_t cb = st; size_t cb = st;
if (cb > STORE_BUFFER_SIZE - writepos) if (cb > STORE_BUFFER_SIZE - writepos)
cb = STORE_BUFFER_SIZE - writepos; cb = STORE_BUFFER_SIZE - writepos;
if (cb > chunklen - chunkpos/* bytes left in chunk*/) if (cb > chunklen - chunkpos/* bytes left in chunk*/)
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos); cb = (size_t)/*SAFE*/(chunklen - chunkpos);
memcpy(ps->new.buffer + writepos, pb, cb); memcpy(ps->new.buffer + writepos, pb, cb);
chunkpos += (png_uint_32)/*SAFE*/cb; chunkpos += (png_uint_32)/*SAFE*/cb;
...@@ -1440,7 +1440,7 @@ store_read_buffer_next(png_store *ps) ...@@ -1440,7 +1440,7 @@ store_read_buffer_next(png_store *ps)
* during progressive read, where the io_ptr is set internally by libpng. * during progressive read, where the io_ptr is set internally by libpng.
*/ */
static void static void
store_read_imp(png_store *ps, png_bytep pb, png_size_t st) store_read_imp(png_store *ps, png_bytep pb, size_t st)
{ {
if (ps->current == NULL || ps->next == NULL) if (ps->current == NULL || ps->next == NULL)
png_error(ps->pread, "store state damaged"); png_error(ps->pread, "store state damaged");
...@@ -1463,14 +1463,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st) ...@@ -1463,14 +1463,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
} }
} }
static png_size_t static size_t
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max, store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
const png_size_t min)
{ {
png_uint_32 chunklen = ps->chunklen; png_uint_32 chunklen = ps->chunklen;
png_uint_32 chunktype = ps->chunktype; png_uint_32 chunktype = ps->chunktype;
png_uint_32 chunkpos = ps->chunkpos; png_uint_32 chunkpos = ps->chunkpos;
png_size_t st = max; size_t st = max;
if (st > 0) do if (st > 0) do
{ {
...@@ -1601,8 +1600,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max, ...@@ -1601,8 +1600,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
store_read_imp(ps, pb, avail); store_read_imp(ps, pb, avail);
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail); ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
pb += (png_size_t)/*SAFE*/avail; pb += (size_t)/*SAFE*/avail;
st -= (png_size_t)/*SAFE*/avail; st -= (size_t)/*SAFE*/avail;
chunkpos += (png_uint_32)/*SAFE*/avail; chunkpos += (png_uint_32)/*SAFE*/avail;
IDAT_size -= (png_uint_32)/*SAFE*/avail; IDAT_size -= (png_uint_32)/*SAFE*/avail;
IDAT_pos += (png_uint_32)/*SAFE*/avail; IDAT_pos += (png_uint_32)/*SAFE*/avail;
...@@ -1669,10 +1668,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max, ...@@ -1669,10 +1668,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
else /* Return chunk bytes, including the CRC */ else /* Return chunk bytes, including the CRC */
{ {
png_size_t avail = st; size_t avail = st;
if (avail > chunklen - chunkpos) if (avail > chunklen - chunkpos)
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos); avail = (size_t)/*SAFE*/(chunklen - chunkpos);
store_read_imp(ps, pb, avail); store_read_imp(ps, pb, avail);
pb += avail; pb += avail;
...@@ -1698,7 +1697,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max, ...@@ -1698,7 +1697,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
} }
static void PNGCBAPI static void PNGCBAPI
store_read(png_structp ppIn, png_bytep pb, png_size_t st) store_read(png_structp ppIn, png_bytep pb, size_t st)
{ {
png_const_structp pp = ppIn; png_const_structp pp = ppIn;
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp)); png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
...@@ -1724,7 +1723,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi) ...@@ -1724,7 +1723,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
while (store_read_buffer_avail(ps) > 0) while (store_read_buffer_avail(ps) > 0)
{ {
static png_uint_32 noise = 2; static png_uint_32 noise = 2;
png_size_t cb; size_t cb;
png_byte buffer[512]; png_byte buffer[512];
/* Generate 15 more bits of stuff: */ /* Generate 15 more bits of stuff: */
...@@ -2991,7 +2990,7 @@ modifier_setbuffer(png_modifier *pm) ...@@ -2991,7 +2990,7 @@ modifier_setbuffer(png_modifier *pm)
* png_struct. * png_struct.
*/ */
static void static void
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st) modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
{ {
while (st > 0) while (st > 0)
{ {
...@@ -3137,7 +3136,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st) ...@@ -3137,7 +3136,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
*/ */
if (len+12 <= sizeof pm->buffer) if (len+12 <= sizeof pm->buffer)
{ {
png_size_t s = len+12-pm->buffer_count; size_t s = len+12-pm->buffer_count;
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s); store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
pm->buffer_count = len+12; pm->buffer_count = len+12;
...@@ -3196,7 +3195,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st) ...@@ -3196,7 +3195,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
/* The callback: */ /* The callback: */
static void PNGCBAPI static void PNGCBAPI
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st) modifier_read(png_structp ppIn, png_bytep pb, size_t st)
{ {
png_const_structp pp = ppIn; png_const_structp pp = ppIn;
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp)); png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
...@@ -3226,7 +3225,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi) ...@@ -3226,7 +3225,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
for (;;) for (;;)
{ {
static png_uint_32 noise = 1; static png_uint_32 noise = 1;
png_size_t cb, cbAvail; size_t cb, cbAvail;
png_byte buffer[512]; png_byte buffer[512];
/* Generate 15 more bits of stuff: */ /* Generate 15 more bits of stuff: */
...@@ -5001,7 +5000,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id, ...@@ -5001,7 +5000,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
dp->npalette = 0; dp->npalette = 0;
/* Preset the transparent color to black: */ /* Preset the transparent color to black: */
memset(&dp->transparent, 0, sizeof dp->transparent); memset(&dp->transparent, 0, sizeof dp->transparent);
/* Preset the palette to full intensity/opaque througout: */ /* Preset the palette to full intensity/opaque throughout: */
memset(dp->palette, 0xff, sizeof dp->palette); memset(dp->palette, 0xff, sizeof dp->palette);
} }
...@@ -5270,7 +5269,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi) ...@@ -5270,7 +5269,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
*/ */
standard_palette_validate(dp, pp, pi); standard_palette_validate(dp, pp, pi);
/* In any case always check for a tranparent color (notice that the /* In any case always check for a transparent color (notice that the
* colour type 3 case must not give a successful return on the get_tRNS call * colour type 3 case must not give a successful return on the get_tRNS call
* with these arguments!) * with these arguments!)
*/ */
...@@ -6780,7 +6779,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp, ...@@ -6780,7 +6779,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
store_image_check(dp->this.ps, pp, 0); store_image_check(dp->this.ps, pp, 0);
/* Read the palette corresponding to the output if the output colour type /* Read the palette corresponding to the output if the output colour type
* indicates a palette, othewise set out_palette to garbage. * indicates a palette, otherwise set out_palette to garbage.
*/ */
if (out_ct == PNG_COLOR_TYPE_PALETTE) if (out_ct == PNG_COLOR_TYPE_PALETTE)
{ {
...@@ -7991,7 +7990,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this, ...@@ -7991,7 +7990,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
/* Now calculate the actual gray values. Although the error in the /* Now calculate the actual gray values. Although the error in the
* coefficients depends on whether they were specified on the command * coefficients depends on whether they were specified on the command
* line (in which case truncation to 15 bits happened) or not (rounding * line (in which case truncation to 15 bits happened) or not (rounding
* was used) the maxium error in an individual coefficient is always * was used) the maximum error in an individual coefficient is always
* 2/32768, because even in the rounding case the requirement that * 2/32768, because even in the rounding case the requirement that
* coefficients add up to 32768 can cause a larger rounding error. * coefficients add up to 32768 can cause a larger rounding error.
* *
...@@ -8207,7 +8206,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this, ...@@ -8207,7 +8206,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
that->bluef = that->greenf = that->redf = gray; that->bluef = that->greenf = that->redf = gray;
that->bluee = that->greene = that->rede = err; that->bluee = that->greene = that->rede = err;
/* The sBIT is the minium of the three colour channel sBITs. */ /* The sBIT is the minimum of the three colour channel sBITs. */
if (that->red_sBIT > that->green_sBIT) if (that->red_sBIT > that->green_sBIT)
that->red_sBIT = that->green_sBIT; that->red_sBIT = that->green_sBIT;
if (that->red_sBIT > that->blue_sBIT) if (that->red_sBIT > that->blue_sBIT)
...@@ -9746,7 +9745,7 @@ gamma_component_validate(const char *name, const validate_info *vi, ...@@ -9746,7 +9745,7 @@ gamma_component_validate(const char *name, const validate_info *vi,
* *
* pngvalid calculations: * pngvalid calculations:
* input_sample: linear result; i linearized and composed, range 0..1 * input_sample: linear result; i linearized and composed, range 0..1
* encoded_sample: encoded result; input_sample scaled to ouput bit depth * encoded_sample: encoded result; input_sample scaled to output bit depth
* *
* libpng calculations: * libpng calculations:
* output: linear result; od scaled to 0..1 and linearized * output: linear result; od scaled to 0..1 and linearized
...@@ -10183,10 +10182,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp, ...@@ -10183,10 +10182,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
* Since the library must quantize the output to 8 or 16 bits there is * Since the library must quantize the output to 8 or 16 bits there is
* a fundamental limit on the accuracy of the output of +/-.5 - this * a fundamental limit on the accuracy of the output of +/-.5 - this
* quantization limit is included in addition to the other limits * quantization limit is included in addition to the other limits
* specified by the paramaters to the API. (Effectively, add .5 * specified by the parameters to the API. (Effectively, add .5
* everywhere.) * everywhere.)
* *
* The behavior of the 'sbit' paramter is defined by section 12.5 * The behavior of the 'sbit' parameter is defined by section 12.5
* (sample depth scaling) of the PNG spec. That section forces the * (sample depth scaling) of the PNG spec. That section forces the
* decoder to assume that the PNG values have been scaled if sBIT is * decoder to assume that the PNG values have been scaled if sBIT is
* present: * present:
...@@ -11729,7 +11728,7 @@ int main(int argc, char **argv) ...@@ -11729,7 +11728,7 @@ int main(int argc, char **argv)
/* Some default values (set the behavior for 'make check' here). /* Some default values (set the behavior for 'make check' here).
* These values simply control the maximum error permitted in the gamma * These values simply control the maximum error permitted in the gamma
* transformations. The practial limits for human perception are described * transformations. The practical limits for human perception are described
* below (the setting for maxpc16), however for 8 bit encodings it isn't * below (the setting for maxpc16), however for 8 bit encodings it isn't
* possible to meet the accepted capabilities of human vision - i.e. 8 bit * possible to meet the accepted capabilities of human vision - i.e. 8 bit
* images can never be good enough, regardless of encoding. * images can never be good enough, regardless of encoding.
......
...@@ -60,7 +60,7 @@ read_png(FILE *fp) ...@@ -60,7 +60,7 @@ read_png(FILE *fp)
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
{ {
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr); size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
/* Failure to initialize these is harmless */ /* Failure to initialize these is harmless */
row = malloc(rowbytes); row = malloc(rowbytes);
......
...@@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv) ...@@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
do do
{ {
png_size_t index; size_t index;
int state, failed = 0; int state, failed = 0;
char buffer[64]; char buffer[64];
...@@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv) ...@@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
} }
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0)) else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
{ {
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n", fprintf(stderr, "%g[%d] -> '%s' but positive value not so reported\n",
test, precision, buffer); test, precision, buffer);
failed = 1; failed = 1;
assert(!PNG_FP_IS_NEGATIVE(state)); assert(!PNG_FP_IS_NEGATIVE(state));
...@@ -329,7 +329,7 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch) ...@@ -329,7 +329,7 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
{ {
/* Test this character (ch) to ensure the parser does the correct thing. /* Test this character (ch) to ensure the parser does the correct thing.
*/ */
png_size_t index = 0; size_t index = 0;
const char test = (char)ch; const char test = (char)ch;
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index); const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
const int character_accepted = (index == 1); const int character_accepted = (index == 1);
......
...@@ -65,7 +65,7 @@ typedef struct ...@@ -65,7 +65,7 @@ typedef struct
} io_data; } io_data;
static PNG_CALLBACK(void, read_and_copy, static PNG_CALLBACK(void, read_and_copy,
(png_structp png_ptr, png_bytep buffer, png_size_t cb)) (png_structp png_ptr, png_bytep buffer, size_t cb))
{ {
io_data *io = (io_data*)png_get_io_ptr(png_ptr); io_data *io = (io_data*)png_get_io_ptr(png_ptr);
...@@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr, ...@@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
png_read_info(png_ptr, info_ptr); png_read_info(png_ptr, info_ptr);
{ {
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr); size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = voidcast(png_bytep,malloc(rowbytes)); row = voidcast(png_bytep,malloc(rowbytes));
display = voidcast(png_bytep,malloc(rowbytes)); display = voidcast(png_bytep,malloc(rowbytes));
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
FROM gcr.io/oss-fuzz-base/base-builder FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER glennrp@gmail.com MAINTAINER glennrp@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake libtool zlib1g-dev RUN apt-get update && \
apt-get install -y make autoconf automake libtool
RUN git clone --depth 1 https://github.com/madler/zlib.git
RUN git clone --depth 1 https://github.com/glennrp/libpng.git RUN git clone --depth 1 https://github.com/glennrp/libpng.git
RUN (cd libpng; git log | head -1) RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
WORKDIR libpng WORKDIR libpng
COPY build.sh $SRC/
...@@ -24,13 +24,13 @@ The files are ...@@ -24,13 +24,13 @@ The files are
Filename or derived Copyright License Filename or derived Copyright License
========================= ========== ================ ========== ========================= ========== ================ ==========
Dockerfile* derived 2017, Glenn R-P Apache 2.0 Dockerfile* derived 2017, Glenn R-P Apache 2.0
build.sh* derived 2017, Glenn R-P Apache 2.0 build.sh derived 2017, Glenn R-P Apache 2.0
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
png.dict original 2015, Chrome Devs Chromium png.dict original 2015, Chrome Devs Chromium
README.txt (this file) original 2017, Glenn R-P libpng README.txt (this file) original 2017, Glenn R-P libpng
* Dockerfile and build.sh are copies of the files used by oss-fuzz. * Dockerfile is a copy of the file used by oss-fuzz. build.sh,
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz, png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
which retrieves them from the libpng repository at Github. which retrieves them from the libpng repository at Github.
......
#!/bin/bash -eu #!/bin/bash -eu
# Copyright 2017 Glenn Randers-Pehrson # Copyright 2017-2018 Glenn Randers-Pehrson
# Copyright 2016 Google Inc. # Copyright 2016 Google Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
...@@ -14,12 +14,13 @@ ...@@ -14,12 +14,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# Last changed in libpng 1.6.33 [September 28, 2017] # Last changed in libpng 1.6.35 [July 15, 2018]
# #
# Revisions by Glenn Randers-Pehson, 2017: # Revisions by Glenn Randers-Pehrson, 2017:
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to # 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
# "make -j$(nproc) libpng16.la"). # "make -j$(nproc) libpng16.la").
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa. # 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
# 3. Build zlib alongside libpng
################################################################################ ################################################################################
# Disable logging via library build configuration control. # Disable logging via library build configuration control.
...@@ -30,9 +31,9 @@ cat scripts/pnglibconf.dfa | \ ...@@ -30,9 +31,9 @@ cat scripts/pnglibconf.dfa | \
> scripts/pnglibconf.dfa.temp > scripts/pnglibconf.dfa.temp
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
# build the library. # build the libpng library.
autoreconf -f -i autoreconf -f -i
./configure ./configure --with-libpng-prefix=OSS_FUZZ_
make -j$(nproc) clean make -j$(nproc) clean
make -j$(nproc) libpng16.la make -j$(nproc) libpng16.la
......
// libpng_read_fuzzer.cc // libpng_read_fuzzer.cc
// Copyright 2017 Glenn Randers-Pehrson // Copyright 2017-2018 Glenn Randers-Pehrson
// Copyright 2015 The Chromium Authors. All rights reserved. // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that may // Use of this source code is governed by a BSD-style license that may
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE // be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
// Last changed in libpng 1.6.32 [August 24, 2017] // Last changed in libpng 1.6.35 [July 15, 2018]
// The modifications in 2017 by Glenn Randers-Pehrson include // The modifications in 2017 by Glenn Randers-Pehrson include
// 1. addition of a PNG_CLEANUP macro, // 1. addition of a PNG_CLEANUP macro,
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// 3. adding "#include <string.h>" which is needed on some platforms // 3. adding "#include <string.h>" which is needed on some platforms
// to provide memcpy(). // to provide memcpy().
// 4. adding read_end_info() and creating an end_info structure. // 4. adding read_end_info() and creating an end_info structure.
// 5. adding calls to png_set_*() transforms commonly used by browsers.
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
...@@ -67,7 +68,7 @@ struct PngObjectHandler { ...@@ -67,7 +68,7 @@ struct PngObjectHandler {
} }
}; };
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr)); BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
if (length > buf_state->bytes_left) { if (length > buf_state->bytes_left) {
png_error(png_ptr, "read error"); png_error(png_ptr, "read error");
...@@ -136,9 +137,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -136,9 +137,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Reading. // Reading.
png_read_info(png_handler.png_ptr, png_handler.info_ptr); png_read_info(png_handler.png_ptr, png_handler.info_ptr);
png_handler.row_ptr = png_malloc(
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
png_handler.info_ptr));
// reset error handler to put png_deleter into scope. // reset error handler to put png_deleter into scope.
if (setjmp(png_jmpbuf(png_handler.png_ptr))) { if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
...@@ -163,8 +161,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -163,8 +161,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0; return 0;
} }
// Set several transforms that browsers typically use:
png_set_gray_to_rgb(png_handler.png_ptr);
png_set_expand(png_handler.png_ptr);
png_set_packing(png_handler.png_ptr);
png_set_scale_16(png_handler.png_ptr);
png_set_tRNS_to_alpha(png_handler.png_ptr);
int passes = png_set_interlace_handling(png_handler.png_ptr); int passes = png_set_interlace_handling(png_handler.png_ptr);
png_start_read_image(png_handler.png_ptr);
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
png_handler.row_ptr = png_malloc(
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
png_handler.info_ptr));
for (int pass = 0; pass < passes; ++pass) { for (int pass = 0; pass < passes; ++pass) {
for (png_uint_32 y = 0; y < height; ++y) { for (png_uint_32 y = 0; y < height; ++y) {
......
此差异已折叠。
...@@ -17,7 +17,7 @@ express or implied warranty. ...@@ -17,7 +17,7 @@ express or implied warranty.
Some history Some history
------------ ------------
Soon after the creation of PNG in 1995, the need was felt for a set of Soon after the creation of PNG in 1995, the need was felt for a set of
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
(Willem van Schaik) started such a project. Luckily we discovered this (Willem van Schaik) started such a project. Luckily we discovered this
and merged the two together into pnmtopng.tar.gz, which is available and merged the two together into pnmtopng.tar.gz, which is available
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/. from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
......
...@@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm ...@@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
REM -- full-color REM -- full-color
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
REM -- palletted REM -- paletted
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
...@@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm ...@@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
REM -- full-color REM -- full-color
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
REM -- palletted REM -- paletted
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册