Compare commits

..

24 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
870fcc9b64 [libpng15] Imported from libpng-1.5.27beta01.tar 2016-03-09 12:04:14 -06:00
Glenn Randers-Pehrson
09779deaa9 [libpng15] Added a common-law trademark notice and export control information
to the LICENSE file, png.h, and the man page.
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
(Robert C. Seacord).
2016-02-14 13:10:43 -06:00
Glenn Randers-Pehrson
55aea59737 [libpng15] Make pnglibconf.h a public header in CmakeLists.txt 2016-02-09 08:44:30 -06:00
Roger Leigh
1f2fe83987 [libpng15] Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
2016-02-08 18:43:58 -06:00
John Bowler
1cef0c0eae pngvalid: backport autoconf exit(77) fix
Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-28 16:49:48 -08:00
Glenn Randers-Pehrson
73adedf0e4 [libpng15] Revised workaround for Coverity issue in pngvalid.c 2016-01-23 10:06:58 -06:00
Glenn Randers-Pehrson
7190c4f5af [libpng15] Worked around a false-positive Coverity issue in pngvalid.c. 2016-01-13 09:55:15 -06:00
Glenn Randers-Pehrson
d189b54e30 [libpng15] Happy 2016! Updated copyright year. 2016-01-02 14:09:11 -06:00
Glenn Randers-Pehrson
c583ec1579 [libpng15] In projects/vstudio, combined readme.txt and WARNING into README.txt 2015-12-29 08:43:51 -06:00
Glenn Randers-Pehrson
89a025317c [libpng15] Update CHANGES and ANNOUNCE with recent pngvalid.c update 2015-12-17 20:22:16 -06:00
Glenn Randers-Pehrson
7c32176ba0 Merge branch 'libpng15' of git://github.com/jbowler/libpng-1 into libpng15 2015-12-17 20:19:23 -06:00
Glenn Randers-Pehrson
684c68d6fb [libpng15] Bump version to 1.5.27beta01 2015-12-17 20:09:18 -06:00
John Bowler
829cba63d3 Fix undefined behavior in pngvalid.c
Undefined because (png_byte) << shift is undefined if it changes the signed bit
(because png_byte is promoted to int).  The libpng exported functions
png_get_uint_32 and png_get_uint_16 handle this.

Bug reported by David Drysdale as a result of reports from UBSAN in clang 3.8.

This changes pngvalid to use BE random numbers; this used to produce errors but
these should not be fixed as a result of the previous changes.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-17 12:57:49 -08:00
John Bowler
b409572cec Merge branch 'libpng15' of ../../libpng into libpng15 2015-12-17 09:40:11 -08:00
Glenn Randers-Pehrson
94322f3f8f [libpng15] Imported from libpng-1.5.26.tar 2015-12-17 08:11:20 -06:00
John Bowler
aff684567e pngvalid from libpng 1.7 with fixes
Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-15 08:28:02 -08:00
Glenn Randers-Pehrson
8f1c1a6d8c [libpng15] Imported from libpng-1.5.26rc01.tar 2015-12-13 21:44:19 -06:00
Glenn Randers-Pehrson
fd3cd9fad2 [libpng15] Update some last-changed dates 2015-12-13 18:36:30 -06:00
Glenn Randers-Pehrson
2921aa280f Merge branch 'libpng15-20151213-keyword' of git://github.com/jbowler/libpng-1 into libpng15 2015-12-13 18:20:11 -06:00
John Bowler
e40ac66f81 [libpng15] Do png_check_keyword in png_set_*() 2015-12-13 18:10:53 -06:00
Glenn Randers-Pehrson
a510a813ef [libpng15] Remove new redundant prototype for png_set_keyword() 2015-12-13 17:35:11 -06:00
Glenn Randers-Pehrson
ad5f16c406 [libpng15] Bump version to 1.5.26beta02 2015-12-13 16:19:49 -06:00
Glenn Randers-Pehrson
2b5be93866 [libpng15] Move png_check_keyword() from pngwutil.c to pngset.c 2015-12-13 16:18:58 -06:00
John Bowler
8d28ab2101 Move png_check_keyword to pngset.c
This is a backport of the libpng16 version with the warnings switched
off.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-12-13 13:44:34 -08:00
55 changed files with 1214 additions and 539 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.5.26beta01 - December 11, 2015
Libpng 1.5.27beta01 - March 9, 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.
@@ -9,26 +9,51 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.26beta01.tar.xz (LZMA-compressed, recommended)
1.5.26beta01.tar.gz
1.5.27beta01.tar.xz (LZMA-compressed, recommended)
1.5.27beta01.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
lp1526b01.7z (LZMA-compressed, recommended)
lp1526b01.zip
lp1527b01.7z (LZMA-compressed, recommended)
lp1527b01.zip
Other information:
1.5.26beta01-README.txt
1.5.26beta01-LICENSE.txt
libpng-1.5.26beta01-*.asc (armored detached GPG signatures)
1.5.27beta01-README.txt
1.5.27beta01-LICENSE.txt
libpng-1.5.27beta01-*.asc (armored detached GPG signatures)
Changes since the last public release (1.5.25):
Changes since the last public release (1.5.26):
version 1.5.26 [December 11, 2015]
Fixed an out-of-range read in png_check_keyword() (Bug report from
Qixue Xiao, CVE-2015-8540).
version 1.5.27beta01 [March 9, 2016]
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
in the BigEndian tests by not testing it, making the BE code the same
as the LE version.
Fixes to pngvalid for various reduced build configurations (eliminate unused
statics) and a fix for the case in rgb_to_gray when the digitize option
reduces graylo to 0, producing a large error.
Widened the 'limit' check on the internally calculated error limits in
the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
checks) and changed the check to only operate in non-release builds
(base build type not RC or RELEASE.)
Fixed undefined behavior in pngvalid.c, undefined because
(png_byte) << shift is undefined if it changes the signed bit
(because png_byte is promoted to int). The libpng exported functions
png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
David Drysdale as a result of reports from UBSAN in clang 3.8).
This changes pngvalid to use BE random numbers; this used to produce
errors but these should not be fixed as a result of the previous changes.
In projects/vstudio, combined readme.txt and WARNING into README.txt
Worked around a false-positive Coverity issue in pngvalid.c.
Only use exit(77) from pngvalid.c in configure builds.
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
Added a common-law trademark notice and export control information
to the LICENSE file, png.h, and the man page.
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
(Robert C. Seacord).
Fixed some misleading indentation in pngvalid.c (Krishnaraj Bhat).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

40
CHANGES
View File

@@ -4256,7 +4256,8 @@ Version 1.5.19 [August 21, 2014]
Version 1.5.20beta01 [November 6, 2014]
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
Only mark text chunks as written after successfully writing them.
Avoid out-of-bounds memory access in png_user_version_check().
Fixed an out-of-range read in png_user_version_check() (Bug report from
Qixue Xiao, CVE-2015-8540).
Simplified and future-proofed png_user_version_check().
Version 1.5.20beta02 [November 10, 2014]
@@ -4446,6 +4447,43 @@ version 1.5.26beta01 [December 11, 2015]
Fixed an out-of-range read in png_check_keyword() (Bug report from
Qixue Xiao, CVE-2015-8540).
version 1.5.26rc01 [December 14, 2015]
Corrected copyright dates in source files.
Moved png_check_keyword() from pngwutil.c to pngset.c
Added keyword checks to pngset.c (John Bowler).
version 1.5.26 [December 17, 2015]
No changes.
version 1.5.27beta01 [March 9, 2016]
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
in the BigEndian tests by not testing it, making the BE code the same
as the LE version.
Fixes to pngvalid for various reduced build configurations (eliminate unused
statics) and a fix for the case in rgb_to_gray when the digitize option
reduces graylo to 0, producing a large error.
Widened the 'limit' check on the internally calculated error limits in
the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
checks) and changed the check to only operate in non-release builds
(base build type not RC or RELEASE.)
Fixed undefined behavior in pngvalid.c, undefined because
(png_byte) << shift is undefined if it changes the signed bit
(because png_byte is promoted to int). The libpng exported functions
png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
David Drysdale as a result of reports from UBSAN in clang 3.8).
This changes pngvalid to use BE random numbers; this used to produce
errors but these should not be fixed as a result of the previous changes.
In projects/vstudio, combined readme.txt and WARNING into README.txt
Worked around a false-positive Coverity issue in pngvalid.c.
Only use exit(77) from pngvalid.c in configure builds.
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
Added a common-law trademark notice and export control information
to the LICENSE file, png.h, and the man page.
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
(Robert C. Seacord).
Fixed some misleading indentation in pngvalid.c (Krishnaraj Bhat).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@@ -1,13 +1,32 @@
# CMakeLists.txt
# Copyright (C) 2007-2015 Glenn Randers-Pehrson
# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson
# Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012
# Revised by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
cmake_minimum_required(VERSION 2.8.3)
cmake_policy(VERSION 2.8.3)
# Set MacOSX @rpath usage globally.
if (POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
# Use new variable expansion policy.
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif(POLICY CMP0053)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif(POLICY CMP0054)
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
@@ -16,7 +35,7 @@ enable_testing()
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 5)
set(PNGLIB_RELEASE 26)
set(PNGLIB_RELEASE 27)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -47,32 +66,220 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF)
option(PNG_DEBUG "Build with debug output" OFF)
option(PNGARG "Disable ANSI-C prototypes" OFF)
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
# SET LIBNAME
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
# Use the prebuilt pnglibconf.h file from the scripts folder
# TODO: fix this by building with awk; without this no cmake build can be
# configured directly (to do so indirectly use your local awk to build a
# pnglibconf.h in the build directory.)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
include(CheckCSourceCompiles)
option(ld-version-script "Enable linker version script" ON)
if(ld-version-script AND NOT APPLE)
# Check if LD supports linker scripts.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
global: sym;
local: *;
};
VERS_2 {
global: sym2;
main;
} VERS_1;
")
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
check_c_source_compiles("void sym(void) {}
void sym2(void) {}
int main(void) {return 0;}
" HAVE_LD_VERSION_SCRIPT)
if(NOT HAVE_LD_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
check_c_source_compiles("void sym(void) {}
void sym2(void) {}
int main(void) {return 0;}
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
endif()
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
endif()
find_program(AWK NAMES gawk awk)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(NOT AWK)
# No awk available to generate sources; use pre-built pnglibconf.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
add_custom_target(genfiles) # Dummy
else()
include(CMakeParseArguments)
# Generate .chk from .out with awk
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
function(generate_chk)
set(options)
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GC_INPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
endif()
if (NOT _GC_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
endif()
add_custom_command(OUTPUT "${_GC_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GC_INPUT}"
"-DOUTPUT=${_GC_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
# Generate .out from .c with awk
# generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
function(generate_out)
set(options)
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GO_INPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
endif()
if (NOT _GO_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
endif()
add_custom_command(OUTPUT "${_GO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GO_INPUT}"
"-DOUTPUT=${_GO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
# Generate specific source file with awk
# generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
function(generate_source)
set(options)
set(oneValueArgs OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _GSO_OUTPUT)
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
endif()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=${_GSO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
DEPENDS ${_GSO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
# Copy file
function(generate_copy source destination)
add_custom_command(OUTPUT "${destination}"
COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
"${destination}"
DEPENDS "${source}")
endfunction()
# Generate scripts/pnglibconf.h
generate_source(OUTPUT "scripts/pnglibconf.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
# Generate pnglibconf.c
generate_source(OUTPUT "pnglibconf.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
# Generate pnglibconf.h
generate_source(OUTPUT "pnglibconf.h"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
${PNGLIBCONF_H_EXTRA_DEPENDS})
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
add_custom_target(symbol-check DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
add_custom_target("genprebuilt"
COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# A single target handles generation of all generated files. If
# they are dependend upon separately by multiple targets, this
# confuses parallel make (it would require a separate top-level
# target for each file to track the dependencies properly).
add_custom_target(genfiles DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
endif(NOT AWK)
# OUR SOURCES
set(libpng_public_hdrs
png.h
pngconf.h
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
)
set(libpng_private_hdrs
pngpriv.h
pngdebug.h
pnginfo.h
pngstruct.h
)
set(libpng_sources
${libpng_public_hdrs}
pngdebug.h
pnginfo.h
pngpriv.h
pngstruct.h
${libpng_private_hdrs}
png.c
pngerror.c
pngget.c
@@ -95,7 +302,6 @@ set(pngtest_sources
set(pngvalid_sources
contrib/libtests/pngvalid.c
)
# SOME NEEDED DEFINITIONS
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
@@ -111,33 +317,59 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
unset(PNG_LIB_TARGETS)
if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
add_library(png SHARED ${libpng_sources})
set(PNG_LIB_TARGETS png)
set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
add_dependencies(png genfiles)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
set_target_properties(png PROPERTIES PREFIX "lib")
set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY})
if(UNIX AND AWK)
if(HAVE_LD_VERSION_SCRIPT)
set_target_properties(png PROPERTIES LINK_FLAGS
"-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
set_target_properties(png PROPERTIES LINK_FLAGS
"-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
endif()
endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_STATIC)
# does not work without changing name
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_STATIC})
set(PNG_LIB_NAME_STATIC png_static)
add_library(png_static STATIC ${libpng_sources})
add_dependencies(png_static genfiles)
# MSVC doesn't use a different file extension for shared vs. static
# libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
if(NOT MSVC)
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1)
else()
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}_static"
CLEAN_DIRECT_OUTPUT 1)
endif()
list(APPEND PNG_LIB_TARGETS png_static)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
set_target_properties(png_static PROPERTIES PREFIX "lib")
endif()
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_FRAMEWORK)
set(PNG_LIB_NAME_FRAMEWORK ${PNG_LIB_NAME}_framework)
add_library(${PNG_LIB_NAME_FRAMEWORK} SHARED ${libpng_sources})
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_FRAMEWORK})
set_target_properties(${PNG_LIB_NAME_FRAMEWORK} PROPERTIES
set(PNG_LIB_NAME_FRAMEWORK png_framework)
add_library(png_framework SHARED ${libpng_sources})
add_dependencies(png_framework genfiles)
list(APPEND PNG_LIB_TARGETS png_framework)
set_target_properties(png_framework PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${PNGLIB_VERSION}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
@@ -146,7 +378,7 @@ if(PNG_FRAMEWORK)
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER "${libpng_public_hdrs}"
OUTPUT_NAME png)
target_link_libraries(${PNG_LIB_NAME_FRAMEWORK} ${ZLIB_LIBRARY} ${M_LIBRARY})
target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(NOT PNG_LIB_TARGETS)
@@ -157,18 +389,88 @@ if(NOT PNG_LIB_TARGETS)
endif()
if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
set_target_properties(png PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif()
function(png_add_test)
set(options)
set(oneValueArgs NAME COMMAND)
set(multiValueArgs OPTIONS FILES)
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT _PAT_NAME)
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
endif()
if (NOT _PAT_COMMAND)
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
endif()
set(TEST_OPTIONS "${_PAT_OPTIONS}")
set(TEST_FILES "${_PAT_FILES}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
add_test(NAME "${_PAT_NAME}"
COMMAND "${CMAKE_COMMAND}"
"-DLIBPNG=$<TARGET_FILE:png>"
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
else() # old 2.x add_test; limited and won't work well on Windows
# Note LIBPNG is a dummy value as there are no generator expressions
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
"-DTEST_COMMAND=./${_PAT_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
endif()
endfunction()
if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue
# Find test PNG files by globbing, but sort lists to ensure
# consistency between different filesystems.
file(GLOB PNGSUITE_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/*.png")
list(SORT PNGSUITE_PNGS)
file(GLOB TEST_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/*.png")
list(SORT TEST_PNGS)
set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
#
target_link_libraries(pngtest png)
png_add_test(NAME pngtest COMMAND pngtest FILES "${PNGTEST_PNG}")
add_executable(pngvalid ${pngvalid_sources})
target_link_libraries(pngvalid ${PNG_LIB_NAME})
add_test(pngvalid ./pngvalid)
target_link_libraries(pngvalid png)
png_add_test(NAME pngvalid-gamma-16-to-8
COMMAND pngvalid OPTIONS --gamma-16-to-8)
png_add_test(NAME pngvalid-gamma-alpha-mode
COMMAND pngvalid OPTIONS --gamma-alpha-mode)
png_add_test(NAME pngvalid-gamma-background
COMMAND pngvalid OPTIONS --gamma-background)
png_add_test(NAME pngvalid-gamma-expand16-alpha-mode
COMMAND pngvalid OPTIONS --gamma-alpha-mode --expand16)
png_add_test(NAME pngvalid-gamma-expand16-background
COMMAND pngvalid OPTIONS --gamma-background --expand16)
png_add_test(NAME pngvalid-gamma-expand16-transform
COMMAND pngvalid OPTIONS --gamma-transform --expand16)
png_add_test(NAME pngvalid-gamma-sbit
COMMAND pngvalid OPTIONS --gamma-sbit)
png_add_test(NAME pngvalid-gamma-threshold
COMMAND pngvalid OPTIONS --gamma-threshold)
png_add_test(NAME pngvalid-gamma-transform
COMMAND pngvalid OPTIONS --gamma-transform)
png_add_test(NAME pngvalid-progressive-interlace-standard
COMMAND pngvalid OPTIONS --standard --progressive-read --interlace)
png_add_test(NAME pngvalid-progressive-size
COMMAND pngvalid OPTIONS --size --progressive-read)
png_add_test(NAME pngvalid-progressive-standard
COMMAND pngvalid OPTIONS --standard --progressive-read)
png_add_test(NAME pngvalid-standard
COMMAND pngvalid OPTIONS --standard)
png_add_test(NAME pngvalid-transform
COMMAND pngvalid OPTIONS --transform)
endif()
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
@@ -197,6 +499,15 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
endmacro()
# Create source generation scripts.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
# libpng is a library so default to 'lib'
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
@@ -223,22 +534,12 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.26beta01
set_target_properties(png PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.27beta01
VERSION 15.${PNGLIB_RELEASE}.0
SOVERSION 15
CLEAN_DIRECT_OUTPUT 1)
endif()
if(PNG_STATIC)
# MSVC doesn't use a different file extension for shared vs. static
# libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
if(NOT MSVC)
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1)
endif()
endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
@@ -261,14 +562,14 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
if(CYGWIN OR MINGW)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(CYGWIN OR MINGW)
if(NOT WIN32)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -277,7 +578,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_STATIC)
if(NOT WIN32 OR CYGWIN OR MINGW)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -297,6 +598,11 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
endif(NOT WIN32 OR CYGWIN OR MINGW)
endif()
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
install(TARGETS ${PNG_BIN_TARGETS}
RUNTIME DESTINATION bin)
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages
if(NOT PNG_MAN_DIR)

27
LICENSE
View File

@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000, through 1.5.26beta01, December 11, 2015, are
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 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
added to the list of Contributing Authors:
@@ -94,18 +94,29 @@ appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:
TRADEMARK:
printf("%s", png_get_copyright(NULL));
The name "libpng" has not been registered by the Copyright owner
as a trademark in any jurisdiction. However, because libpng has
been distributed and maintained world-wide, continually since 1995,
the Copyright owner claims "common-law trademark protection" in any
jurisdiction where common-law trademark is recognized.
Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
EXPORT CONTROL:
The Copyright owner believes that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because
it is open source, publicly available software, that does not contain
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
734.7(b).
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
December 11, 2015
March 9, 2016

2
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.26beta01 - December 11, 2015 (shared library 15.0)
README for libpng version 1.5.27beta01 - March 9, 2016 (shared library 15.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

24
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libpng 1.5.26beta01.
# Generated by GNU Autoconf 2.69 for libpng 1.5.27beta01.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.5.26beta01'
PACKAGE_STRING='libpng 1.5.26beta01'
PACKAGE_VERSION='1.5.27beta01'
PACKAGE_STRING='libpng 1.5.27beta01'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@@ -1354,7 +1354,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.5.26beta01 to adapt to many kinds of systems.
\`configure' configures libpng 1.5.27beta01 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1424,7 +1424,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.5.26beta01:";;
short | recursive ) echo "Configuration of libpng 1.5.27beta01:";;
esac
cat <<\_ACEOF
@@ -1579,7 +1579,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.5.26beta01
libpng configure 1.5.27beta01
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2002,7 +2002,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.5.26beta01, which was
It was created by libpng $as_me 1.5.27beta01, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2865,7 +2865,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.5.26beta01'
VERSION='1.5.27beta01'
cat >>confdefs.h <<_ACEOF
@@ -2982,10 +2982,10 @@ fi
PNGLIB_VERSION=1.5.26beta01
PNGLIB_VERSION=1.5.27beta01
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=26
PNGLIB_RELEASE=27
@@ -14124,7 +14124,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.5.26beta01, which was
This file was extended by libpng $as_me 1.5.27beta01, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14190,7 +14190,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libpng config.status 1.5.26beta01
libpng config.status 1.5.27beta01
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -18,15 +18,15 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.5.26beta01], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.5.27beta01], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE([1.13 serial-tests subdir-objects])
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.5.26beta01
PNGLIB_VERSION=1.5.27beta01
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=26
PNGLIB_RELEASE=27
dnl End of version number stuff

View File

@@ -1,8 +1,8 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
* Last changed in libpng 1.5.25 [(PENDING RELEASE)]
* Copyright (c) 2014-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.6.22 [(PENDING RELEASE)]
* Copyright (c) 2014-2016 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
* This code is released under the libpng license.
@@ -62,10 +62,10 @@
/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
* a skipped test, in earlier versions we need to succeed on a skipped test, so:
*/
#if PNG_LIBPNG_VER < 10601
# define SKIP 0
#else
#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
# define SKIP 77
#else
# define SKIP 0
#endif
/* pngvalid requires write support and one of the fixed or floating point APIs.
@@ -116,6 +116,16 @@ typedef png_byte *png_const_bytep;
# define png_const_structp png_structp
#endif
#ifndef RELEASE_BUILD
/* RELEASE_BUILD is true for releases and release candidates: */
# define RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
#endif
#if RELEASE_BUILD
# define debugonly(something)
#else /* !RELEASE_BUILD */
# define debugonly(something) something
#endif /* !RELEASE_BUILD */
#include <float.h> /* For floating point constants */
#include <stdlib.h> /* For malloc */
#include <string.h> /* For memcpy, memset */
@@ -276,7 +286,8 @@ make_four_random_bytes(png_uint_32* seed, png_bytep bytes)
make_random_bytes(seed, bytes, 4);
}
#if defined PNG_READ_SUPPORTED || defined PNG_WRITE_tRNS_SUPPORTED
#if defined PNG_READ_SUPPORTED || defined PNG_WRITE_tRNS_SUPPORTED ||\
defined PNG_WRITE_FILTER_SUPPORTED
static void
randomize(void *pv, size_t size)
{
@@ -284,19 +295,56 @@ randomize(void *pv, size_t size)
make_random_bytes(random_seed, pv, size);
}
#define RANDOMIZE(this) randomize(&(this), sizeof (this))
#endif /* READ || WRITE_tRNS */
#define R8(this) randomize(&(this), sizeof (this))
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
static void r16(png_uint_16p p16, size_t count)
{
size_t i;
for (i=0; i<count; ++i)
{
unsigned char b2[2];
randomize(b2, sizeof b2);
*p16++ = png_get_uint_16(b2);
}
}
#define R16(this) r16(&(this), (sizeof (this))/(sizeof (png_uint_16)))
#define R16_1(this) r16(&(this), (size_t) 1U)
#if defined PNG_READ_RGB_TO_GRAY_SUPPORTED ||\
defined PNG_READ_FILLER_SUPPORTED
static void r32(png_uint_32p p32, size_t count)
{
size_t i;
for (i=0; i<count; ++i)
{
unsigned char b4[4];
randomize(b4, sizeof b4);
*p32++ = png_get_uint_32(b4);
}
}
#define R32(this) r32(&(this), (sizeof (this))/(sizeof (png_uint_32)))
#define R32_1(this) r32(&(this), (size_t) 1U)
#endif /* READ_FILLER || READ_RGB_TO_GRAY */
#endif /* READ || WRITE_tRNS || WRITE_FILTER */
#if defined PNG_READ_TRANSFORMS_SUPPORTED ||\
defined PNG_WRITE_FILTER_SUPPORTED
static unsigned int
random_mod(unsigned int max)
{
unsigned int x;
png_uint_16 x;
RANDOMIZE(x);
R16_1(x);
return x % max; /* 0 .. max-1 */
}
#endif /* READ_TRANSFORMS || WRITE_FILTER */
#if (defined PNG_READ_RGB_TO_GRAY_SUPPORTED) ||\
(defined PNG_READ_FILLER_SUPPORTED)
@@ -305,12 +353,11 @@ random_choice(void)
{
unsigned char x;
RANDOMIZE(x);
R8(x);
return x & 1;
}
#endif
#endif /* PNG_READ_SUPPORTED */
#endif /* READ_RGB_TO_GRAY || READ_FILLER */
/* A numeric ID based on PNG file characteristics. The 'do_interlace' field
* simply records whether pngvalid did the interlace itself or whether it
@@ -1974,6 +2021,8 @@ typedef struct png_modifier
* internal check on pngvalid to ensure that the calculated error limits are
* not ridiculous; without this it is too easy to make a mistake in pngvalid
* that allows any value through.
*
* NOTE: this is not checked in release builds.
*/
double limit; /* limit on error values, normally 4E-3 */
@@ -3258,10 +3307,10 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
for (; i<256; ++i)
tRNS[i] = 24;
# ifdef PNG_WRITE_tRNS_SUPPORTED
if (j > 0)
png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
# endif
#ifdef PNG_WRITE_tRNS_SUPPORTED
if (j > 0)
png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
#endif
}
}
@@ -3278,12 +3327,14 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
png_color_16 tRNS;
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
RANDOMIZE(tRNS);
R8(tRNS); /* makes unset fields random */
if (colour_type & 2/*RGB*/)
{
if (bit_depth == 8)
{
R16(tRNS.red);
R16(tRNS.green);
tRNS.blue = tRNS.red ^ tRNS.green;
tRNS.red &= mask;
tRNS.green &= mask;
@@ -3292,13 +3343,17 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
else /* bit_depth == 16 */
{
R16(tRNS.red);
tRNS.green = (png_uint_16)(tRNS.red * 257);
tRNS.blue = (png_uint_16)(tRNS.green * 17);
}
}
else
{
R16(tRNS.gray);
tRNS.gray &= mask;
}
png_set_tRNS(pp, pi, NULL, 0, &tRNS);
}
@@ -3649,6 +3704,28 @@ deinterlace_row(png_bytep buffer, png_const_bytep row,
* layout details. See make_size_images below for a way to make images
* that test odd sizes along with the libpng interlace handling.
*/
#ifdef PNG_WRITE_FILTER_SUPPORTED
static void
choose_random_filter(png_structp pp, int start)
{
/* Choose filters randomly except that on the very first row ensure that
* there is at least one previous row filter.
*/
int filters = PNG_ALL_FILTERS & random_mod(256U);
/* There may be no filters; skip the setting. */
if (filters != 0)
{
if (start && filters < PNG_FILTER_UP)
filters |= PNG_FILTER_UP;
png_set_filter(pp, 0/*method*/, filters);
}
}
#else /* !WRITE_FILTER */
# define choose_random_filter(pp, start) ((void)0)
#endif /* !WRITE_FILTER */
static void
make_transform_image(png_store* const ps, png_byte const colour_type,
png_byte const bit_depth, unsigned int palette_number,
@@ -3767,6 +3844,7 @@ make_transform_image(png_store* const ps, png_byte const colour_type,
}
# endif /* do_own_interlace */
choose_random_filter(pp, pass == 0 && y == 0);
png_write_row(pp, buffer);
}
}
@@ -3943,9 +4021,6 @@ make_size_image(png_store* const ps, png_byte const colour_type,
int npasses = npasses_from_interlace_type(pp, interlace_type);
png_uint_32 y;
int pass;
# ifdef PNG_WRITE_FILTER_SUPPORTED
int nfilter = PNG_FILTER_VALUE_LAST;
# endif
png_byte image[16][SIZE_ROWMAX];
/* To help consistent error detection make the parts of this buffer
@@ -4008,15 +4083,19 @@ make_size_image(png_store* const ps, png_byte const colour_type,
* does accept a filter number (per the spec) as well as a bit
* mask.
*
* The apparent wackiness of decrementing nfilter rather than
* incrementing is so that Paeth gets used in all images bigger
* than 1 row - it's the tricky one.
* The code now uses filters at random, except that on the first
* row of an image it ensures that a previous row filter is in
* the set so that libpng allocates the row buffer.
*/
png_set_filter(pp, 0/*method*/,
nfilter >= PNG_FILTER_VALUE_LAST ? PNG_ALL_FILTERS : nfilter);
{
int filters = 8 << random_mod(PNG_FILTER_VALUE_LAST);
if (nfilter-- == 0)
nfilter = PNG_FILTER_VALUE_LAST-1;
if (pass == 0 && y == 0 &&
(filters < PNG_FILTER_UP || w == 1U))
filters |= PNG_FILTER_UP;
png_set_filter(pp, 0/*method*/, filters);
}
# endif
png_write_row(pp, row);
@@ -4244,62 +4323,71 @@ make_error(png_store* const ps, png_byte const colour_type,
#undef exception__env
/* And clear these flags */
ps->expect_error = 0;
ps->expect_warning = 0;
/* Now write the whole image, just to make sure that the detected, or
* undetected, errro has not created problems inside libpng.
*/
if (png_get_rowbytes(pp, pi) !=
transform_rowsize(pp, colour_type, bit_depth))
png_error(pp, "row size incorrect");
if (ps->expect_error)
ps->expect_error = 0;
else
{
int npasses = set_write_interlace_handling(pp, interlace_type);
int pass;
/* Now write the whole image, just to make sure that the detected, or
* undetected, errro has not created problems inside libpng. This
* doesn't work if there was a png_error in png_write_info because that
* can abort before PLTE was written.
*/
if (png_get_rowbytes(pp, pi) !=
transform_rowsize(pp, colour_type, bit_depth))
png_error(pp, "row size incorrect");
if (npasses != npasses_from_interlace_type(pp, interlace_type))
png_error(pp, "write: png_set_interlace_handling failed");
for (pass=0; pass<npasses; ++pass)
else
{
png_uint_32 y;
int npasses = set_write_interlace_handling(pp, interlace_type);
int pass;
for (y=0; y<h; ++y)
if (npasses != npasses_from_interlace_type(pp, interlace_type))
png_error(pp, "write: png_set_interlace_handling failed");
for (pass=0; pass<npasses; ++pass)
{
png_byte buffer[TRANSFORM_ROWMAX];
png_uint_32 y;
transform_row(pp, buffer, colour_type, bit_depth, y);
for (y=0; y<h; ++y)
{
png_byte buffer[TRANSFORM_ROWMAX];
# if do_own_interlace
/* If do_own_interlace *and* the image is interlaced we need a
* reduced interlace row; this may be reduced to empty.
*/
if (interlace_type == PNG_INTERLACE_ADAM7)
{
/* The row must not be written if it doesn't exist, notice
* that there are two conditions here, either the row isn't
* ever in the pass or the row would be but isn't wide
* enough to contribute any pixels. In fact the wPass test
* can be used to skip the whole y loop in this case.
transform_row(pp, buffer, colour_type, bit_depth, y);
# if do_own_interlace
/* If do_own_interlace *and* the image is interlaced we
* need a reduced interlace row; this may be reduced to
* empty.
*/
if (PNG_ROW_IN_INTERLACE_PASS(y, pass) &&
PNG_PASS_COLS(w, pass) > 0)
interlace_row(buffer, buffer,
bit_size(pp, colour_type, bit_depth), w, pass,
0/*data always bigendian*/);
else
continue;
}
# endif /* do_own_interlace */
if (interlace_type == PNG_INTERLACE_ADAM7)
{
/* The row must not be written if it doesn't exist,
* notice that there are two conditions here, either the
* row isn't ever in the pass or the row would be but
* isn't wide enough to contribute any pixels. In fact
* the wPass test can be used to skip the whole y loop
* in this case.
*/
if (PNG_ROW_IN_INTERLACE_PASS(y, pass) &&
PNG_PASS_COLS(w, pass) > 0)
interlace_row(buffer, buffer,
bit_size(pp, colour_type, bit_depth), w, pass,
0/*data always bigendian*/);
else
continue;
}
# endif /* do_own_interlace */
png_write_row(pp, buffer);
png_write_row(pp, buffer);
}
}
}
}
} /* image writing */
png_write_end(pp, pi);
png_write_end(pp, pi);
}
/* The following deletes the file that was just written. */
store_write_reset(ps);
@@ -6257,7 +6345,7 @@ transform_range_check(png_const_structp pp, unsigned int r, unsigned int g,
unsigned int max = (1U<<sample_depth)-1;
double in_min = ceil((in-err)*max - digitization_error);
double in_max = floor((in+err)*max + digitization_error);
if (err > limit || !(out >= in_min && out <= in_max))
if (debugonly(err > limit ||) !(out >= in_min && out <= in_max))
{
char message[256];
size_t pos;
@@ -6283,6 +6371,8 @@ transform_range_check(png_const_structp pp, unsigned int r, unsigned int g,
png_error(pp, message);
}
UNUSED(limit)
}
static void
@@ -7213,7 +7303,7 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
png_uint_32 ru;
double total;
RANDOMIZE(ru);
R32_1(ru);
data.green_coefficient = total = (ru & 0xffff) / 65535.;
ru >>= 16;
data.red_coefficient = (1 - total) * (ru & 0xffff) / 65535.;
@@ -7274,14 +7364,12 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
* When DIGITIZE is set because a pre-1.7 version of libpng is being
* tested allow a bigger slack.
*
* NOTE: this magic number was determined by experiment to be about
* 1.263. There's no great merit to the value below, however it only
* affects the limit used for checking for internal calculation errors,
* not the actual limit imposed by pngvalid on the output errors.
* NOTE: this number only affects the internal limit check in pngvalid,
* it has no effect on the limits applied to the libpng values.
*/
that->pm->limit += pow(
# if DIGITIZE
1.3
2.0
# else
1.0
# endif
@@ -7443,7 +7531,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
/* Image now has RGB channels... */
# if DIGITIZE
{
const png_modifier *pm = display->pm;
png_modifier *pm = display->pm;
const unsigned int sample_depth = that->sample_depth;
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
sample_depth);
@@ -7592,9 +7680,11 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
else
{
err = fabs(grayhi-gray);
if (fabs(gray - graylo) > err)
err = fabs(graylo-gray);
#if !RELEASE_BUILD
/* Check that this worked: */
if (err > pm->limit)
{
@@ -7605,11 +7695,13 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
pos = safecatd(buffer, sizeof buffer, pos, err, 6);
pos = safecat(buffer, sizeof buffer, pos, " exceeds limit ");
pos = safecatd(buffer, sizeof buffer, pos, pm->limit, 6);
png_error(pp, buffer);
png_warning(pp, buffer);
pm->limit = err;
}
#endif /* !RELEASE_BUILD */
}
}
# else /* DIGITIZE */
# else /* !DIGITIZE */
{
double r = that->redf;
double re = that->rede;
@@ -7668,7 +7760,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
* lookups in the calculation and each introduces a quantization
* error defined by the table size.
*/
const png_modifier *pm = display->pm;
png_modifier *pm = display->pm;
double in_qe = (that->sample_depth > 8 ? .5/65535 : .5/255);
double out_qe = (that->sample_depth > 8 ? .5/65535 :
(pm->assume_16_bit_calculations ? .5/(1<<display->max_gamma_8) :
@@ -7718,6 +7810,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
else
err -= in_qe;
#if !RELEASE_BUILD
/* Validate that the error is within limits (this has caused
* problems before, it's much easier to detect them here.)
*/
@@ -7730,8 +7823,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
pos = safecatd(buffer, sizeof buffer, pos, err, 6);
pos = safecat(buffer, sizeof buffer, pos, " exceeds limit ");
pos = safecatd(buffer, sizeof buffer, pos, pm->limit, 6);
png_error(pp, buffer);
png_warning(pp, buffer);
pm->limit = err;
}
#endif /* !RELEASE_BUILD */
}
}
# endif /* !DIGITIZE */
@@ -7802,7 +7897,7 @@ image_transform_png_set_background_set(const image_transform *this,
* so we need to know what that is! The background colour is stored in the
* transform_display.
*/
RANDOMIZE(random_bytes);
R8(random_bytes);
/* Read the random value, for colour type 3 the background colour is actually
* expressed as a 24bit rgb, not an index.
@@ -7830,7 +7925,7 @@ image_transform_png_set_background_set(const image_transform *this,
/* Extract the background colour from this image_pixel, but make sure the
* unused fields of 'back' are garbage.
*/
RANDOMIZE(back);
R8(back);
if (colour_type & PNG_COLOR_MASK_COLOR)
{
@@ -7842,11 +7937,11 @@ image_transform_png_set_background_set(const image_transform *this,
else
back.gray = (png_uint_16)data.red;
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
# else
png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
# endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
#else
png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
#endif
this->next->set(this->next, that, pp, pi);
}
@@ -8136,7 +8231,7 @@ image_transform_png_set_filler_set(const image_transform *this,
* filler. The 'filler' value has all 32 bits set, but only bit_depth
* will be used. At this point we don't know bit_depth.
*/
RANDOMIZE(data.filler);
R32(data.filler);
data.flags = random_choice();
png_set_filler(pp, data.filler, data.flags);
@@ -8209,7 +8304,7 @@ image_transform_png_set_add_alpha_set(const image_transform *this,
* filler. The 'filler' value has all 32 bits set, but only bit_depth
* will be used. At this point we don't know bit_depth.
*/
RANDOMIZE(data.filler);
R32(data.filler);
data.flags = random_choice();
png_set_add_alpha(pp, data.filler, data.flags);
@@ -11296,6 +11391,9 @@ int main(int argc, char **argv)
else if (strcmp(*argv, "-w") == 0 ||
strcmp(*argv, "--strict") == 0)
pm.this.treat_warnings_as_errors = 1; /* NOTE: this is the default! */
else if (strcmp(*argv, "--nostrict") == 0)
pm.this.treat_warnings_as_errors = 0;
else if (strcmp(*argv, "--speed") == 0)

View File

@@ -1,6 +1,6 @@
Libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.26beta01 - December 11, 2015
libpng version 1.5.27beta01 - March 9, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 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.5.26beta01 - December 11, 2015
libpng versions 0.97, January 1998, through 1.5.27beta01 - March 9, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -4127,7 +4127,8 @@ There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info,
deprecated in earlier versions of libpng, has been completely removed from
libpng 1.5.
libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
header files were created.
We no longer include zlib.h in png.h. The include statement has been moved
to pngstruct.h, where it is not accessible by applications. Applications that
@@ -4515,7 +4516,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.26beta01 are Y2K compliant. It is my belief that earlier
upward through 1.5.27beta01 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer

View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "December 11, 2015"
.TH LIBPNG 3 "March 9, 2016"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.26beta01
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.27beta01
.SH SYNOPSIS
\fB
#include <png.h>\fP
@@ -496,7 +496,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.5.26beta01 - December 11, 2015
libpng version 1.5.27beta01 - March 9, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -507,7 +507,7 @@ Libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.5.26beta01 - December 11, 2015
libpng versions 0.97, January 1998, through 1.5.27beta01 - March 9, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -4623,7 +4623,8 @@ There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info,
deprecated in earlier versions of libpng, has been completely removed from
libpng 1.5.
libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
header files were created.
We no longer include zlib.h in png.h. The include statement has been moved
to pngstruct.h, where it is not accessible by applications. Applications that
@@ -5011,7 +5012,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.26beta01 are Y2K compliant. It is my belief that earlier
upward through 1.5.27beta01 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -5108,9 +5109,9 @@ the first widely used release:
...
1.0.19 10 10019 10.so.0.19[.0]
...
1.2.53 13 10253 12.so.0.53[.0]
1.2.56 13 10256 12.so.0.56[.0]
...
1.5.25 15 10525 15.so.15.25[.0]
1.5.27 15 10527 15.so.15.27[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -5166,7 +5167,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.26beta01 - December 11, 2015:
Libpng version 1.5.27beta01 - March 9, 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).
@@ -5191,8 +5192,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000, through 1.5.26beta01, December 11, 2015, are
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 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
added to the list of Contributing Authors:
@@ -5275,6 +5276,29 @@ appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
TRADEMARK:
The name "libpng" has not been registered by the Copyright owner
as a trademark in any jurisdiction. However, because libpng has
been distributed and maintained world-wide, continually since 1995,
the Copyright owner claims "common-law trademark protection" in any
jurisdiction where common-law trademark is recognized.
OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
EXPORT CONTROL:
The Copyright owner believes that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because
it is open source, publicly available software, that does not contain
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
734.7(b).
A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:
@@ -5283,13 +5307,9 @@ boxes and the like:
Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
December 11, 2015
March 9, 2016
.\" end of man page

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "December 11, 2015"
.TH LIBPNGPF 3 "March 9, 2016"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.26beta01
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.27beta01
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"

2
png.5
View File

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

13
png.c
View File

@@ -2,7 +2,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_26beta01 Your_png_h_is_not_version_1_5_26beta01;
typedef png_libpng_version_1_5_27beta01 Your_png_h_is_not_version_1_5_27beta01;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -655,14 +655,15 @@ png_get_copyright(png_const_structp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.5.26beta01 - December 11, 2015" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"libpng version 1.5.27beta01 - March 9, 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.5.26beta01 - December 11, 2015\
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
return "libpng version 1.5.27beta01 - March 9, 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.";
# endif

89
png.h
View File

@@ -1,9 +1,9 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.26beta01, December 11, 2015
* libpng version 1.5.27beta01, March 9, 2016
*
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -12,7 +12,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.26beta01, December 11, 2015:
* libpng versions 0.97, January 1998, through 1.5.27beta01, March 9, 2016:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,8 +25,8 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.0.7, July 1, 2000, through 1.5.26beta01, December 11, 2015, are
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
* libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 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
* added to the list of Contributing Authors:
@@ -108,6 +108,29 @@
* appreciated.
*
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
*
* TRADEMARK:
*
* The name "libpng" has not been registered by the Copyright owner
* as a trademark in any jurisdiction. However, because libpng has
* been distributed and maintained world-wide, continually since 1995,
* the Copyright owner claims "common-law trademark protection" in any
* jurisdiction where common-law trademark is recognized.
*
* OSI CERTIFICATION:
*
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
* a certification mark of the Open Source Initiative. OSI has not addressed
* the additional disclaimers inserted at version 1.0.7.
*
* EXPORT CONTROL:
*
* The Copyright owner believes that the Export Control Classification
* Number (ECCN) for libpng is EAR99, which means not subject to export
* controls or International Traffic in Arms Regulations (ITAR) because
* it is open source, publicly available software, that does not contain
* any encryption software. See the EAR, paragraphs 734.3(b)(3) and
* 734.7(b).
*/
/*
@@ -120,12 +143,6 @@
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
*/
/*
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
* a certification mark of the Open Source Initiative. OSI has not addressed
* the additional disclaimers inserted at version 1.0.7.
*/
/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
@@ -181,9 +198,9 @@
* ...
* 1.0.19 10 10019 10.so.0.19[.0]
* ...
* 1.2.53 13 10253 12.so.0.53[.0]
* 1.2.56 13 10256 12.so.0.56[.0]
* ...
* 1.5.25 15 10525 15.so.15.25[.0]
* 1.5.27 15 10527 15.so.15.27[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -211,13 +228,13 @@
* Y2K compliance in libpng:
* =========================
*
* December 11, 2015
* March 9, 2016
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.5.26beta01 are Y2K compliant. It is my belief that
* upward through 1.5.27beta01 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -278,9 +295,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.26beta01"
#define PNG_LIBPNG_VER_STRING "1.5.27beta01"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.26beta01 - December 11, 2015\n"
" libpng version 1.5.27beta01 - March 9, 2016\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@@ -288,7 +305,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 5
#define PNG_LIBPNG_VER_RELEASE 26
#define PNG_LIBPNG_VER_RELEASE 27
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -319,7 +336,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
#define PNG_LIBPNG_VER 10526 /* 1.5.26 */
#define PNG_LIBPNG_VER 10527 /* 1.5.27 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -441,7 +458,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_5_26beta01;
typedef char* png_libpng_version_1_5_27beta01;
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
@@ -705,22 +722,22 @@ typedef png_info FAR * FAR * png_infopp;
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*/
#define PNG_INFO_gAMA 0x0001
#define PNG_INFO_sBIT 0x0002
#define PNG_INFO_cHRM 0x0004
#define PNG_INFO_PLTE 0x0008
#define PNG_INFO_tRNS 0x0010
#define PNG_INFO_bKGD 0x0020
#define PNG_INFO_hIST 0x0040
#define PNG_INFO_pHYs 0x0080
#define PNG_INFO_oFFs 0x0100
#define PNG_INFO_tIME 0x0200
#define PNG_INFO_pCAL 0x0400
#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
#define PNG_INFO_gAMA 0x0001U
#define PNG_INFO_sBIT 0x0002U
#define PNG_INFO_cHRM 0x0004U
#define PNG_INFO_PLTE 0x0008U
#define PNG_INFO_tRNS 0x0010U
#define PNG_INFO_bKGD 0x0020U
#define PNG_INFO_hIST 0x0040U
#define PNG_INFO_pHYs 0x0080U
#define PNG_INFO_oFFs 0x0100U
#define PNG_INFO_tIME 0x0200U
#define PNG_INFO_pCAL 0x0400U
#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using

View File

@@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.26beta01, December 11, 2015
* libpng version 1.5.27beta01, March 9, 2016
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Last changed in libpng 1.5.18 [February 6, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.5.19 [August 21, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.5.19 [August 21, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pnginfo.h - header file for PNG reference library
*
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.5.13 [September 27, 2012]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -1,8 +1,8 @@
/* pngpriv.h - private declarations for use inside libpng
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.5.26 [(PENDING RELEASE)]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -901,13 +901,6 @@ PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr,
png_const_uint_16p hist, int num_hist));
#endif
/* Chunks that have keywords */
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
png_const_charp key, png_charpp new_key));
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key,
png_const_charp text, png_size_t text_len));

View File

@@ -2,7 +2,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.5.24 [November 12, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.5.25 [(PENDING RELEASE)]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.5.25 [December 3, 2015]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

121
pngset.c
View File

@@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.5.24 [November 12, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.5.26 [December 17, 2015]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -20,6 +20,60 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) ||\
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
* and if invalid, correct the keyword rather than discarding the entire
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
* length, forbids leading or trailing whitespace, multiple internal spaces,
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
*
* The 'new_key' buffer must be 80 characters in size (for the keyword plus a
* trailing '\0'). If this routine returns 0 then there was no keyword, or a
* valid one could not be generated, and the caller must handle the error by not
* setting the keyword.
*/
static png_uint_32
png_check_keyword(png_const_charp key, png_bytep new_key)
{
png_uint_32 key_len = 0;
int space = 1;
if (key == NULL)
{
*new_key = 0;
return 0;
}
while (*key && key_len < 79)
{
png_byte ch = (png_byte)*key++;
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
*new_key++ = ch, ++key_len, space = 0;
else if (space == 0)
{
/* A space or an invalid character when one wasn't seen immediately
* before; output just a space.
*/
*new_key++ = 32, ++key_len, space = 1;
}
}
if (key_len > 0 && space != 0) /* trailing space */
--key_len, --new_key;
/* Terminate the keyword */
*new_key = 0;
if (key_len == 0)
return 0;
return key_len;
}
#endif /* TEXT || pCAL || iCCP || sPLT */
#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr,
@@ -278,6 +332,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
int nparams, png_const_charp units, png_charpp params)
{
png_byte new_purpose[80];
png_size_t length;
int i;
@@ -286,7 +341,15 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
length = png_strlen(purpose) + 1;
length = png_check_keyword(purpose, new_purpose);
if (length == 0)
{
png_warning(png_ptr, "pCAL: invalid purpose keyword");
return;
}
++length;
png_debug1(3, "allocating purpose for info (%lu bytes)",
(unsigned long)length);
@@ -309,7 +372,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
return;
}
png_memcpy(info_ptr->pcal_purpose, purpose, length);
png_memcpy(info_ptr->pcal_purpose, new_purpose, length);
png_debug(3, "storing X0, X1, type, and nparams in info");
info_ptr->pcal_X0 = X0;
@@ -614,6 +677,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_const_charp name, int compression_type,
png_const_bytep profile, png_uint_32 proflen)
{
png_byte new_name[80];
png_charp new_iccp_name;
png_bytep new_iccp_profile;
png_size_t length;
@@ -623,7 +687,15 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return;
length = png_strlen(name)+1;
length = png_check_keyword(name, new_name);
if (length == 0)
{
png_warning(png_ptr, "iCCP: invalid keyword");
return;
}
++length;
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
if (new_iccp_name == NULL)
@@ -632,7 +704,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
return;
}
png_memcpy(new_iccp_name, name, length);
png_memcpy(new_iccp_name, new_name, length);
new_iccp_profile = (png_bytep)png_malloc_warn(png_ptr, proflen);
if (new_iccp_profile == NULL)
@@ -748,6 +820,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
}
for (i = 0; i < num_text; i++)
{
png_byte new_key[80], new_lang[80];
png_size_t text_length, key_len;
png_size_t lang_len, lang_key_len;
png_textp textp = &(info_ptr->text[info_ptr->num_text]);
@@ -762,7 +835,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
continue;
}
key_len = png_strlen(text_ptr[i].key);
key_len = png_check_keyword(text_ptr[i].key, new_key);
if (key_len == 0)
{
png_warning(png_ptr, "invalid text keyword");
continue;
}
if (text_ptr[i].compression <= 0)
{
@@ -775,8 +854,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
{
/* Set iTXt data */
/* Zero length language is OK */
if (text_ptr[i].lang != NULL)
lang_len = png_strlen(text_ptr[i].lang);
lang_len = png_check_keyword(text_ptr[i].lang, new_lang);
else
lang_len = 0;
@@ -824,7 +904,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
(key_len + lang_len + lang_key_len + text_length + 4),
textp->key);
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
png_memcpy(textp->key, new_key, (png_size_t)(key_len));
*(textp->key + key_len) = '\0';
if (text_ptr[i].compression > 0)
@@ -976,7 +1056,7 @@ png_set_sPLT(png_structp png_ptr,
*/
{
png_sPLT_tp np;
int i;
int i, j;
size_t element_size;
if (png_ptr == NULL || info_ptr == NULL)
@@ -1008,13 +1088,22 @@ png_set_sPLT(png_structp png_ptr,
png_free(png_ptr, info_ptr->splt_palettes);
info_ptr->splt_palettes=NULL;
for (i = 0; i < nentries; i++)
for (i = j = 0; i < nentries; i++)
{
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
png_sPLT_tp to = np + info_ptr->splt_palettes_num + j;
png_const_sPLT_tp from = entries + i;
png_byte new_name[80];
png_size_t length;
length = png_strlen(from->name) + 1;
length = png_check_keyword(from->name, new_name);
if (length == 0)
{
png_warning(png_ptr, "sPLT: invalid keyword");
continue;
}
++length; /* for trailing '\0' */
to->name = (png_charp)png_malloc_warn(png_ptr, length);
if (to->name == NULL)
@@ -1024,7 +1113,7 @@ png_set_sPLT(png_structp png_ptr,
continue;
}
png_memcpy(to->name, from->name, length);
png_memcpy(to->name, new_name, length);
to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
from->nentries * png_sizeof(png_sPLT_entry));
@@ -1042,10 +1131,11 @@ png_set_sPLT(png_structp png_ptr,
to->nentries = from->nentries;
to->depth = from->depth;
++j;
}
info_ptr->splt_palettes = np;
info_ptr->splt_palettes_num += nentries;
info_ptr->splt_palettes_num = j;
info_ptr->valid |= PNG_INFO_sPLT;
info_ptr->free_me |= PNG_FREE_SPLT;
}
@@ -1348,5 +1438,4 @@ png_set_check_for_invalid_index(png_structp png_ptr, int allowed)
png_ptr->num_palette_max = -1;
}
#endif
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@@ -2,7 +2,7 @@
/* pngstruct.h - header file for PNG reference library
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -1,8 +1,8 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.5.25 [(PENDING RELEASE)]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.5.25 [December 3, 2015]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -2070,4 +2070,4 @@ main(void)
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_26beta01 Your_png_h_is_not_version_1_5_26beta01;
typedef png_libpng_version_1_5_27beta01 Your_png_h_is_not_version_1_5_27beta01;

View File

@@ -2,7 +2,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.5.19 [August 21, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.5.18 [February 6, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -2,7 +2,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.5.23 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.5.13 [September 27, 2012]
* Copyright (c) 1998-2002,2004,2006-2012 Glenn Randers-Pehrson
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.5.24 [November 12, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.5.26 [December 17, 2015]
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -1099,7 +1099,6 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
png_const_charp profile, int profile_len)
{
png_size_t name_len;
png_charp new_name;
compression_state comp;
int embedded_profile_len = 0;
@@ -1111,8 +1110,7 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
comp.input = NULL;
comp.input_len = 0;
if ((name_len = png_check_keyword(png_ptr, name, &new_name)) == 0)
return;
name_len = png_strlen(name);
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_warning(png_ptr, "Unknown compression type in iCCP chunk");
@@ -1131,8 +1129,6 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
{
png_warning(png_ptr,
"Embedded profile length in iCCP chunk is negative");
png_free(png_ptr, new_name);
return;
}
@@ -1140,8 +1136,6 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
{
png_warning(png_ptr,
"Embedded profile length too large in iCCP chunk");
png_free(png_ptr, new_name);
return;
}
@@ -1161,10 +1155,14 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
png_write_chunk_header(png_ptr, png_iCCP,
(png_uint_32)(name_len + profile_len + 2));
new_name[name_len + 1] = 0x00;
png_write_chunk_data(png_ptr, (png_bytep)name, name_len);
png_write_chunk_data(png_ptr, (png_bytep)new_name,
(png_size_t)(name_len + 2));
{
png_byte buffer[2];
buffer[0] = 0; /* terminate name */
buffer[1] = 0xFFU & compression_type;
png_write_chunk_data(png_ptr, buffer, 2);
}
if (profile_len != 0)
{
@@ -1172,7 +1170,6 @@ png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
}
png_write_chunk_end(png_ptr);
png_free(png_ptr, new_name);
}
#endif
@@ -1182,7 +1179,6 @@ void /* PRIVATE */
png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette)
{
png_size_t name_len;
png_charp new_name;
png_byte entrybuf[10];
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
png_size_t palette_size = entry_size * spalette->nentries;
@@ -1193,14 +1189,13 @@ png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette)
png_debug(1, "in png_write_sPLT");
if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0)
return;
name_len = png_strlen(spalette->name);
/* Make sure we include the NULL after the name */
png_write_chunk_header(png_ptr, png_sPLT,
(png_uint_32)(name_len + 2 + palette_size));
png_write_chunk_data(png_ptr, (png_bytep)new_name,
png_write_chunk_data(png_ptr, (png_bytep)spalette->name,
(png_size_t)(name_len + 1));
png_write_chunk_data(png_ptr, &spalette->depth, (png_size_t)1);
@@ -1256,7 +1251,6 @@ png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette)
#endif
png_write_chunk_end(png_ptr);
png_free(png_ptr, new_name);
}
#endif
@@ -1512,138 +1506,6 @@ png_write_hIST(png_structp png_ptr, png_const_uint_16p hist, int num_hist)
}
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
* and if invalid, correct the keyword rather than discarding the entire
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
* length, forbids leading or trailing whitespace, multiple internal spaces,
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
*
* The new_key is allocated to hold the corrected keyword and must be freed
* by the calling routine. This avoids problems with trying to write to
* static keywords without having to have duplicate copies of the strings.
*/
png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key)
{
png_size_t key_len;
png_const_charp ikp;
png_charp kp, dp;
int kflag;
int kwarn=0;
png_debug(1, "in png_check_keyword");
*new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0)
{
png_warning(png_ptr, "zero length keyword");
return ((png_size_t)0);
}
png_debug1(2, "Keyword to be checked is '%s'", key);
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
if (*new_key == NULL)
{
png_warning(png_ptr, "Out of memory while procesing keyword");
return ((png_size_t)0);
}
/* Replace non-printing characters with a blank and print a warning */
for (ikp = key, dp = *new_key; *ikp != '\0'; ikp++, dp++)
{
if ((png_byte)*ikp < 0x20 ||
((png_byte)*ikp > 0x7E && (png_byte)*ikp < 0xA1))
{
PNG_WARNING_PARAMETERS(p)
png_warning_parameter_unsigned(p, 1, PNG_NUMBER_FORMAT_02x,
(png_byte)*ikp);
png_formatted_warning(png_ptr, p, "invalid keyword character 0x@1");
*dp = ' ';
}
else
{
*dp = *ikp;
}
}
*dp = '\0';
/* Remove any trailing white space. */
kp = *new_key + key_len - 1;
if (*kp == ' ')
{
png_warning(png_ptr, "trailing spaces removed from keyword");
while (key_len && *kp == ' ')
{
*(kp--) = '\0';
key_len--;
}
}
/* Remove any leading white space. */
kp = *new_key;
if (*kp == ' ')
{
png_warning(png_ptr, "leading spaces removed from keyword");
while (*kp == ' ')
{
kp++;
key_len--;
}
}
png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
/* Remove multiple internal spaces. */
for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
{
if (*kp == ' ' && kflag == 0)
{
*(dp++) = *kp;
kflag = 1;
}
else if (*kp == ' ')
{
key_len--;
kwarn = 1;
}
else
{
*(dp++) = *kp;
kflag = 0;
}
}
*dp = '\0';
if (kwarn != 0)
png_warning(png_ptr, "extra interior spaces removed from keyword");
if (key_len == 0)
{
png_free(png_ptr, *new_key);
png_warning(png_ptr, "Zero length keyword");
}
if (key_len > 79)
{
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
(*new_key)[79] = '\0';
key_len = 79;
}
return (key_len);
}
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write a tEXt chunk */
void /* PRIVATE */
@@ -1651,12 +1513,10 @@ png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
png_size_t text_len)
{
png_size_t key_len;
png_charp new_key;
png_debug(1, "in png_write_tEXt");
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
return;
key_len = strlen(key);
if (text == NULL || *text == '\0')
text_len = 0;
@@ -1673,7 +1533,7 @@ png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
* any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
* The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
*/
png_write_chunk_data(png_ptr, (png_bytep)new_key,
png_write_chunk_data(png_ptr, (png_bytep)key,
(png_size_t)(key_len + 1));
if (text_len != 0)
@@ -1681,7 +1541,6 @@ png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
(png_size_t)text_len);
png_write_chunk_end(png_ptr);
png_free(png_ptr, new_key);
}
#endif
@@ -1693,7 +1552,6 @@ png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
{
png_size_t key_len;
png_byte buf;
png_charp new_key;
compression_state comp;
png_debug(1, "in png_write_zTXt");
@@ -1704,16 +1562,11 @@ png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
comp.input = NULL;
comp.input_len = 0;
if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
{
png_free(png_ptr, new_key);
return;
}
key_len = strlen(key);
if (text == NULL || *text == '\0' || compression==PNG_TEXT_COMPRESSION_NONE)
{
png_write_tEXt(png_ptr, new_key, text, (png_size_t)0);
png_free(png_ptr, new_key);
png_write_tEXt(png_ptr, key, text, (png_size_t)0);
return;
}
@@ -1728,11 +1581,9 @@ png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
(png_uint_32)(key_len+text_len + 2));
/* Write key */
png_write_chunk_data(png_ptr, (png_bytep)new_key,
png_write_chunk_data(png_ptr, (png_bytep)key,
(png_size_t)(key_len + 1));
png_free(png_ptr, new_key);
buf = (png_byte)compression;
/* Write compression */
@@ -1753,8 +1604,6 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
png_const_charp lang, png_const_charp lang_key, png_const_charp text)
{
png_size_t lang_len, key_len, lang_key_len, text_len;
png_charp new_lang;
png_charp new_key = NULL;
png_byte cbuf[2];
compression_state comp;
@@ -1765,15 +1614,13 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
comp.output_ptr = NULL;
comp.input = NULL;
if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
return;
key_len = png_strlen(key);
if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang)) == 0)
{
png_warning(png_ptr, "Empty language field in iTXt chunk");
new_lang = NULL;
if (lang == NULL)
lang_len = 0;
}
else
lang_len = png_strlen(lang);
if (lang_key == NULL)
lang_key_len = 0;
@@ -1808,7 +1655,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
* any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
* The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
*/
png_write_chunk_data(png_ptr, (png_bytep)new_key, (png_size_t)(key_len + 1));
png_write_chunk_data(png_ptr, (png_bytep)key, (png_size_t)(key_len + 1));
/* Set the compression flag */
if (compression == PNG_ITXT_COMPRESSION_NONE ||
@@ -1824,7 +1671,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
png_write_chunk_data(png_ptr, cbuf, (png_size_t)2);
cbuf[0] = 0;
png_write_chunk_data(png_ptr, (new_lang ? (png_const_bytep)new_lang : cbuf),
png_write_chunk_data(png_ptr, (lang ? (png_const_bytep)lang : cbuf),
(png_size_t)(lang_len + 1));
png_write_chunk_data(png_ptr, (lang_key ? (png_const_bytep)lang_key : cbuf),
@@ -1833,9 +1680,6 @@ png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
png_write_compressed_data_out(png_ptr, &comp, text_len);
png_write_chunk_end(png_ptr);
png_free(png_ptr, new_key);
png_free(png_ptr, new_lang);
}
#endif
@@ -1869,7 +1713,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_size_t purpose_len, units_len, total_len;
png_size_tp params_len;
png_byte buf[10];
png_charp new_purpose;
int i;
png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
@@ -1877,7 +1720,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
if (type >= PNG_EQUATION_LAST)
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
purpose_len = strlen(purpose) + 1;
png_debug1(3, "pCAL purpose length = %d", (int)purpose_len);
units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
png_debug1(3, "pCAL units length = %d", (int)units_len);
@@ -1899,7 +1742,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_debug1(3, "pCAL total length = %d", (int)total_len);
png_write_chunk_header(png_ptr, png_pCAL, (png_uint_32)total_len);
png_write_chunk_data(png_ptr, (png_const_bytep)new_purpose, purpose_len);
png_write_chunk_data(png_ptr, (png_const_bytep)purpose, purpose_len);
png_save_int_32(buf, X0);
png_save_int_32(buf + 4, X1);
buf[8] = (png_byte)type;
@@ -1907,8 +1750,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_write_chunk_data(png_ptr, buf, (png_size_t)10);
png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
png_free(png_ptr, new_purpose);
for (i = 0; i < nparams; i++)
{
png_write_chunk_data(png_ptr, (png_const_bytep)params[i], params_len[i]);

View File

@@ -1,9 +1,9 @@
VisualStudio instructions
libpng version 1.5.26beta01 - December 11, 2015
libpng version 1.5.27beta01 - March 9, 2016
Copyright (c) 1998-2010 Glenn Randers-Pehrson
Copyright (c) 2010,2013,2016 Glenn Randers-Pehrson
This code is released under the libpng license.
For conditions of distribution and use, see the disclaimer
@@ -13,14 +13,6 @@ This directory contains support for building libpng under MicroSoft
VisualStudio 2010. It may also work under later versions of VisualStudio.
You should be familiar with VisualStudio before using this directory.
WARNING
=======
Libpng 1.5 erroneously uses /MD when building debug DLL versions of libpng.
It should use /MDd - you can change this under properties\C/C++\Code
Generation\Runtime Library if you need to use the debug runtime for debug
builds. This will be changed in libpng 1.6 but is currently retained for
compatibility with older libpng 1.5 releases.
Initial preparations
====================
You must enter some information in zlib.props before attempting to build
@@ -41,21 +33,22 @@ optimization level (e.g. /Od.)
Linking your application
========================
Normally you should link against the 'release' configuration. This builds a
DLL for libpng 1.5 with the default runtime options used by Visual Studio
2010. In particular the runtime library is the "MultiThreaded DLL" version.
DLL for libpng with the default runtime options used by Visual Studio 2010.
In particular the runtime library is the "MultiThreaded DLL" version.
If you use Visual Studio defaults to build your application you will have no
problems.
If you don't use the Visual Studio defaults your application must still be built
with the default runtime option (/MD). If, for some reason, it is not then your
application will crash inside libpng15.dll as soon as libpng tries to read
from a file handle you pass in.
If you don't use the Visual Studio defaults your application must still be
built with the default runtime option (/MD). If, for some reason, it is not
then your application will crash inside libpng15.dll as soon as libpng
tries to read from a file handle you pass in.
If you do not want to use the DLL, for example for a very small application,
the 'release library' configuration may be more appropriate. This is built
with a non-standard runtime library - the "MultiThreaded" version. When you
build your application it must be compiled with this option (/MT), otherwise
it will not build (if you are lucky) or crash (if you are not.)
it will not build (if you are lucky) or crash (if you are not.) See the
WARNING file that is distributed along with this readme.txt.
Stop reading here
=================
@@ -66,7 +59,29 @@ Debug versions have limited support
This solution includes limited support for debug versions of libpng. You
do not need these unless your own solution itself uses debug builds (it is
far more effective to debug on the release builds, there is no point building
a special debug build.)
a special debug build unless you have heap corruption problems that you can't
track down.)
The debug build of libpng is minimally supported. Support for debug builds of
zlib is also minimal. You really don't want to do this.
WARNING
=======
Libpng 1.5.x erroneously uses /MD for Debug DLL builds; if you used the
debug builds in your app and you changed your app to use /MD you will need
to change it back to /MDd for libpng 1.6.0 and later.
The runtime library settings for each build are as follows:
Release Debug
DLL /MD /MDd
Library /MT /MTd
The Visual Studio 2010 defaults for a Win32 DLL or Static Library project are
as follows:
Release Debug
DLL /MD /MDd
Static Library /MD /MDd

View File

@@ -1,23 +0,0 @@
WARNING
=======
Libpng 1.5 erroneously uses /MD when building debug DLL versions of libpng.
It should use /MDd - you can change this under properties\C/C++\Code
Generation\Runtime Library if you need to use the debug runtime for debug
builds. This will be changed in libpng 1.6 but is currently retained for
compatibility with older libpng 1.5 releases.
The runtime library settings for each build are as follows:
Release Debug
DLL /MD /MD
Library /MT /MTd
The Visual Studio 2010 defaults for a Win32 DLL or Static Library project are
as follows:
Release Debug
DLL /MD /MDd
Static Library /MD /MDd
Notice that by default static library builds use the DLL runtime, not the
static library runtime.

View File

@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.5.26beta01 - December 11, 2015
* libpng version 1.5.27beta01 - March 9, 2016
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.5.26beta01 - December 11, 2015
Makefiles for libpng version 1.5.27beta01 - March 9, 2016
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.26beta01)
(gcc, creates libpng15.so.15.1.5.27beta01)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -34,12 +34,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc,
creates libpng15.so.15.1.5.26beta01)
creates libpng15.so.15.1.5.27beta01)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng15.so.15.1.5.26beta01)
creates libpng15.so.15.1.5.27beta01)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng15.so.15.1.5.26beta01)
creates libpng15.so.15.1.5.27beta01)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile

View File

@@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
PNG_DFN ""
PNG_DFN "EXPORTS"
PNG_DFN ";Version 1.5.26beta01"
PNG_DFN ";Version 1.5.27beta01"
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"

37
scripts/genchk.cmake.in Normal file
View File

@@ -0,0 +1,37 @@
# genchk.cmake.in
# Generate .chk from .out with awk (generic), based upon the automake logic.
# Copyright (C) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(AWK "@AWK@")
get_filename_component(INPUTEXT "${INPUT}" EXT)
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
get_filename_component(INPUTDIR "${INPUT}" PATH)
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
if("${INPUTEXT}" STREQUAL ".out" AND "${OUTPUTEXT}" STREQUAL ".chk")
# Generate .chk from .out with awk (generic)
file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/checksym.awk"
"${SRCDIR}/scripts/${INPUTBASE}.def"
"of=${OUTPUTDIR}/${OUTPUTBASE}.new"
"${INPUT}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate ${OUTPUTDIR}/${OUTPUTBASE}.new")
endif()
file(RENAME "${OUTPUTDIR}/${OUTPUTBASE}.new" "${OUTPUT}")
else()
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
endif()

77
scripts/genout.cmake.in Normal file
View File

@@ -0,0 +1,77 @@
# genout.cmake.in
# Generate .out from .c with awk (generic), based upon the automake logic.
# Copyright (C) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
set(AWK "@AWK@")
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@")
set(INCDIR "@CMAKE_CURRENT_BINARY_DIR@")
set(PNG_PREFIX "@PNG_PREFIX@")
set(PNGLIB_MAJOR "@PNGLIB_MAJOR@")
set(PNGLIB_MINOR "@PNGLIB_MINOR@")
set(PNGLIB_VERSION "@PNGLIB_VERSION@")
set(ZLIBINCDIR "@ZLIB_INCLUDE_DIR@")
get_filename_component(INPUTEXT "${INPUT}" EXT)
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
get_filename_component(INPUTDIR "${INPUT}" PATH)
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
if ("${INPUTEXT}" STREQUAL ".c" AND "${OUTPUTEXT}" STREQUAL ".out")
get_filename_component(GENDIR "${OUTPUT}" PATH)
file(MAKE_DIRECTORY "${GENDIR}")
file(REMOVE "${OUTPUT}.tf1" "${OUTPUT}.tf2")
set(INCLUDES "-I${INCDIR}")
if(ZLIBINCDIR)
list(APPEND INCLUDES "-I${ZLIBINCDIR}")
endif()
if(PNG_PREFIX)
set(PNG_PREFIX_DEF "-DPNG_PREFIX=${PNG_PREFIX}")
endif()
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E"
${CMAKE_C_FLAGS}
"-I${SRCDIR}"
"-I${BINDIR}"
"-DPNGLIB_LIBNAME=PNG${PNGLIB_MAJOR}${PNGLIB_MINOR}_0"
"-DPNGLIB_VERSION=${PNGLIB_VERSION}"
"-DSYMBOL_PREFIX=${SYMBOL_PREFIX}"
"-DPNG_NO_USE_READ_MACROS"
"-DPNG_BUILDING_SYMBOL_TABLE"
${PNG_PREFIX_DEF}
"${INPUT}"
OUTPUT_FILE "${OUTPUT}.tf1"
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE CPP_FAIL)
if(CPP_FAIL)
message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf1")
endif()
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/dfn.awk"
"out=${OUTPUT}.tf2" "${OUTPUT}.tf1"
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf2")
endif()
file(REMOVE "${OUTPUT}.tf1")
file(RENAME "${OUTPUT}.tf2" "${OUTPUT}")
else()
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
endif()

98
scripts/gensrc.cmake.in Normal file
View File

@@ -0,0 +1,98 @@
# gensrc.cmake.in
# Generate source files with awk, based upon the automake logic.
# Copyright (C) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
set(AWK "@AWK@")
set(DFA_XTRA "@DFA_XTRA@")
set(PNG_PREFIX "@PNG_PREFIX@")
set(PNGLIB_VERSION "@PNGLIB_VERSION@")
if("${OUTPUT}" STREQUAL "scripts/pnglibconf.c")
# Generate scripts/pnglibconf.c
file(REMOVE "${BINDIR}/pnglibconf.tf6" "${BINDIR}/pnglibconf.tf7")
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "com ${PNGLIB_VERSION} STANDARD API DEFINITION"
COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
"out=pnglibconf.tf6" "logunsupported=1" "version=search"
"${SRCDIR}/pngconf.h" "-"
"${SRCDIR}/scripts/pnglibconf.dfa"
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate pnglibconf.tf6")
endif()
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
"out=pnglibconf.tf7" "pnglibconf.tf6"
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate pnglibconf.tf7")
endif()
file(REMOVE "pnglibconf.tf6")
file(MAKE_DIRECTORY "${BINDIR}/scripts")
file(RENAME "pnglibconf.tf7" "${BINDIR}/scripts/pnglibconf.c")
elseif ("${OUTPUT}" STREQUAL "pnglibconf.c")
# Generate pnglibconf.c
file(REMOVE "${BINDIR}/pnglibconf.tf4" "${BINDIR}/pnglibconf.tf5")
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
out=pnglibconf.tf4 version=search
${SRCDIR}/pngconf.h ${SRCDIR}/scripts/pnglibconf.dfa
${SRCDIR}/pngusr.dfa ${DFA_XTRA}
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate pnglibconf.tf4")
endif()
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
out=pnglibconf.tf5 pnglibconf.tf4
WORKING_DIRECTORY "${BINDIR}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate pnglibconf.tf5")
endif()
file(REMOVE "pnglibconf.tf4")
file(MAKE_DIRECTORY "${BINDIR}/scripts")
file(RENAME "pnglibconf.tf5" "${BINDIR}/pnglibconf.c")
elseif ("${OUTPUT}" STREQUAL "pnglibconf.h")
# Generate pnglibconf.h
file(REMOVE "${BINDIR}/${OUTPUT}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${BINDIR}/pnglibconf.out"
"${BINDIR}/${OUTPUT}"
RESULT_VARIABLE COPY_FAIL)
if(COPY_FAIL)
message(FATAL_ERROR "Failed to create pnglibconf.h")
endif()
elseif("${OUTPUT}" STREQUAL "scripts/pnglibconf.h.prebuilt")
# Generate scripts/pnglibconf.h.prebuilt (fails build)
message(STATUS "Attempting to build scripts/pnglibconf.h.prebuilt")
message(STATUS "This is a machine generated file, but if you want to make")
message(STATUS "a new one simply build the 'genfiles' target, and copy")
message(STATUS "scripts/pnglibconf.out to scripts/pnglibconf.h.prebuilt")
message(STATUS "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)")
message(FATAL_ERROR "Stopping build")
else()
message(FATAL_ERROR "Unsupported output: ${OUTPUT}")
endif()

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config.
version=1.5.26beta01
version=1.5.27beta01
prefix=""
libdir=""
libs=""

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng15
Name: libpng
Description: Loads and saves PNG files
Version: 1.5.26beta01
Version: 1.5.27beta01
Libs: -L${libdir} -lpng15
Cflags: -I${includedir}

View File

@@ -23,7 +23,7 @@
VERMAJ = 1
VERMIN = 5
VERMIC = 26
VERMIC = 27
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng
PACKAGE = $(NAME)-$(VER)

View File

@@ -10,7 +10,7 @@
# Library name:
LIBNAME = libpng15
PNGMAJ = 15
RELEASE = 26
RELEASE = 27
# Shared library names:
LIBSO=$(LIBNAME).so

View File

@@ -18,7 +18,7 @@ exec_prefix=$(prefix)
# Library name:
LIBNAME = libpng15
PNGMAJ = 15
RELEASE = 26
RELEASE = 27
# Shared library names:
LIBSO=$(LIBNAME).dll

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng15
LIB= png15
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.26beta01
SHLIB_MINOR= 1.5.27beta01
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.26beta01
SHLIB_MINOR= 1.5.27beta01
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.26beta01
SHLIB_MINOR= 1.5.27beta01
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \

View File

@@ -3,7 +3,7 @@
#
# last changed in libpng version 1.5.7 - December 15, 2011
#
# Copyright (c) 1998-2011 Glenn Randers-Pehrson
# Copyright (c) 2011 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer

View File

@@ -8,7 +8,7 @@ com pnglibconf.h - library build configuration
com
version
com
com Copyright (c) 1998-2011 Glenn Randers-Pehrson
com Copyright (c) 2011-2015 Glenn Randers-Pehrson
com
com This code is released under the libpng license.
com For conditions of distribution and use, see the disclaimer

View File

@@ -1,9 +1,9 @@
/* 1.5.26beta01 STANDARD API DEFINITION */
/* 1.5.27beta01 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* libpng version 1.5.26beta01 - December 11, 2015 */
/* libpng version 1.5.27beta01 - March 9, 2016 */
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
/* Copyright (c) 2011-2015 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */

View File

@@ -1,4 +1,4 @@
;Version 1.5.26beta01
;Version 1.5.27beta01
;--------------------------------------------------------------
; LIBPNG symbol list as a Win32 DEF file
; Contains all the symbols that can be exported from libpng

31
scripts/test.cmake.in Normal file
View File

@@ -0,0 +1,31 @@
# test.cmake.in
# Copyright (C) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
set(TEST_OPTIONS "@TEST_OPTIONS@")
set(TEST_FILES "@TEST_FILES@")
foreach(file ${TEST_FILES})
file(TO_NATIVE_PATH "${file}" native_file)
list(APPEND NATIVE_TEST_FILES "${native_file}")
endforeach()
# Add the directory containing libpng to the PATH (Windows only)
if(WIN32)
get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH)
file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR)
set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
RESULT_VARIABLE TEST_STATUS)
if(TEST_STATUS)
message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!")
endif()