Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7be585fd
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7be585fd
编写于
8月 11, 2016
作者:
A
azvegint
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8155690: Update libPNG library to the latest up-to-date
Reviewed-by: serb
上级
20a5b2ef
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
796 addition
and
289 deletion
+796
-289
src/share/native/sun/awt/libpng/CHANGES
src/share/native/sun/awt/libpng/CHANGES
+152
-2
src/share/native/sun/awt/libpng/LICENSE
src/share/native/sun/awt/libpng/LICENSE
+26
-8
src/share/native/sun/awt/libpng/README
src/share/native/sun/awt/libpng/README
+1
-1
src/share/native/sun/awt/libpng/png.c
src/share/native/sun/awt/libpng/png.c
+7
-6
src/share/native/sun/awt/libpng/png.h
src/share/native/sun/awt/libpng/png.h
+190
-63
src/share/native/sun/awt/libpng/pngconf.h
src/share/native/sun/awt/libpng/pngconf.h
+2
-2
src/share/native/sun/awt/libpng/pngdebug.h
src/share/native/sun/awt/libpng/pngdebug.h
+1
-1
src/share/native/sun/awt/libpng/pngerror.c
src/share/native/sun/awt/libpng/pngerror.c
+2
-2
src/share/native/sun/awt/libpng/pngget.c
src/share/native/sun/awt/libpng/pngget.c
+8
-8
src/share/native/sun/awt/libpng/pnginfo.h
src/share/native/sun/awt/libpng/pnginfo.h
+1
-1
src/share/native/sun/awt/libpng/pnglibconf.h
src/share/native/sun/awt/libpng/pnglibconf.h
+3
-3
src/share/native/sun/awt/libpng/pngmem.c
src/share/native/sun/awt/libpng/pngmem.c
+1
-1
src/share/native/sun/awt/libpng/pngpread.c
src/share/native/sun/awt/libpng/pngpread.c
+12
-7
src/share/native/sun/awt/libpng/pngpriv.h
src/share/native/sun/awt/libpng/pngpriv.h
+5
-2
src/share/native/sun/awt/libpng/pngread.c
src/share/native/sun/awt/libpng/pngread.c
+94
-58
src/share/native/sun/awt/libpng/pngrio.c
src/share/native/sun/awt/libpng/pngrio.c
+1
-1
src/share/native/sun/awt/libpng/pngrtran.c
src/share/native/sun/awt/libpng/pngrtran.c
+9
-6
src/share/native/sun/awt/libpng/pngrutil.c
src/share/native/sun/awt/libpng/pngrutil.c
+2
-2
src/share/native/sun/awt/libpng/pngset.c
src/share/native/sun/awt/libpng/pngset.c
+92
-6
src/share/native/sun/awt/libpng/pngstruct.h
src/share/native/sun/awt/libpng/pngstruct.h
+1
-1
src/share/native/sun/awt/libpng/pngtest.c
src/share/native/sun/awt/libpng/pngtest.c
+12
-3
src/share/native/sun/awt/libpng/pngtrans.c
src/share/native/sun/awt/libpng/pngtrans.c
+1
-1
src/share/native/sun/awt/libpng/pngwio.c
src/share/native/sun/awt/libpng/pngwio.c
+1
-1
src/share/native/sun/awt/libpng/pngwrite.c
src/share/native/sun/awt/libpng/pngwrite.c
+163
-10
src/share/native/sun/awt/libpng/pngwtran.c
src/share/native/sun/awt/libpng/pngwtran.c
+1
-1
src/share/native/sun/awt/libpng/pngwutil.c
src/share/native/sun/awt/libpng/pngwutil.c
+8
-92
未找到文件。
src/share/native/sun/awt/libpng/CHANGES
浏览文件 @
7be585fd
...
...
@@ -5088,7 +5088,8 @@ Version 1.6.15beta04 [November 4, 2014]
Version 1.6.15beta05 [November 5, 2014]
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
example.c, pngtest.c, and applications in the contrib directory.
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().
Fixed GCC unsigned int->float warnings. Various versions of GCC
seem to generate warnings when an unsigned value is implicitly
...
...
@@ -5446,7 +5447,7 @@ Version 1.6.20beta01 [November 20, 2015]
Version 1.6.20beta02 [November 23, 2015]
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
vulnerability.
vulnerability.
Fixes CVE-2015-8472.
Version 1.6.20beta03 [November 24, 2015]
Backported tests from libpng-1.7.0beta69.
...
...
@@ -5471,6 +5472,155 @@ Version 1.6.20rc02 [November 29, 2015]
Version 1.6.20 [December 3, 2015]
No changes.
Version 1.6.21beta01 [December 11, 2015]
Fixed syntax "$(command)" in tests/pngstest that some shells other than
bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
Version 1.6.21beta02 [December 14, 2015]
Moved png_check_keyword() from pngwutil.c to pngset.c
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.
Version 1.6.21beta03 [December 18, 2015]
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.
Version 1.6.21rc01 [January 4, 2016]
In projects/vstudio, combined readme.txt and WARNING into README.txt
Version 1.6.21rc02 [January 7, 2016]
Relocated assert() in contrib/tools/pngfix.c, bug found by American
Fuzzy Lop, reported by Brian Carpenter.
Marked 'limit' UNUSED in transform_range_check(). This only affects
release builds.
Version 1.6.21 [January 15, 2016]
Worked around a false-positive Coverity issue in pngvalid.c.
Version 1.6.22beta01 [January 23, 2016]
Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
"tmpfile()" implementation in contrib/libtests/pngstest.c
Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
if there is no stdio.h support.
Added a png_image_write_to_memory() API and a number of assist macros
to allow an application that uses the simplified API write to bypass
stdio and write directly to memory.
Added some warnings (png.h) and some check code to detect *possible*
overflow in the ROW_STRIDE and simplified image SIZE macros. This
disallows image width/height/format that *might* overflow. This is
a quiet API change that limits in-memory image size (uncompressed) to
less than 4GByte and image row size (stride) to less than 2GByte.
Revised workaround for false-positive Coverity issue in pngvalid.c.
Version 1.6.22beta02 [February 8, 2016]
Only use exit(77) in configure builds.
Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
the palette size because it failed to take into account that the memory
palette has to be expanded to full RGB when it is written to PNG.
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in (Roger Leigh).
Relaxed limit checks on gamma values in pngrtran.c. As suggested in
the comments gamma values outside the range currently permitted
by png_set_alpha_mode are useful for HDR data encoding. These values
are already permitted by png_set_gamma so it is reasonable caution to
extend the png_set_alpha_mode range as HDR imaging systems are starting
to emerge.
Version 1.6.22beta03 [March 9, 2016]
Added a common-law trademark notice and export control information
to the LICENSE file, png.h, and the man page.
Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
were accidentally removed from libpng-1.6.17.
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
(Robert C. Seacord).
Removed dubious "#if INT_MAX" test from png.h that was added to
libpng-1.6.19beta02 (John Bowler).
Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
Updated LICENSE to say files in the contrib directory are not
necessarily under the libpng license, and that some makefiles have
other copyright owners.
Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
Made contrib/libtests/timepng more robust. The code no longer gives
up/fails on invalid PNG data, it just skips it (with error messages).
The code no longer fails on PNG files with data beyond IEND. Options
exist to use png_read_png (reading the whole image, not by row) and, in
that case, to apply any of the supported transforms. This makes for
more realistic testing; the decoded data actually gets used in a
meaningful fashion (John Bowler).
Fixed some misleading indentation (Krishnaraj Bhat).
Version 1.6.22beta04 [April 5, 2016]
Force GCC compilation to C89 if needed (Dagobert Michelsen).
SSE filter speed improvements for bpp=3:
memcpy-free implementations of load3() / store3().
call load3() only when needed at the end of a scanline.
Version 1.6.22beta05 [April 27, 2016]
Added PNG_FAST_FILTERS macro (defined as
PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
Various fixes for contrib/libtests/timepng.c
Moved INTEL-SSE code from pngpriv.h into contrib/intel/intel_sse.patch.
Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
(Bug report by Y.Ohashik).
Version 1.6.22beta06 [May 5, 2016]
Rebased contrib/intel_sse.patch.
Quieted two Coverity issues in contrib/libtests/timepng.c.
Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
Added support to use multiple directories in ZLIBINCDIR variable,
Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
Fixed pnglibconf.c compilation on OS X including the sysroot path.
Version 1.6.22rc01 [May 14, 2016]
No changes.
Version 1.6.22rc02 [May 16, 2016]
Removed contrib/timepng from default build; it does not build on platforms
that don't supply clock_gettime().
Version 1.6.22rc03 [May 17, 2016]
Restored contrib/timepng to default build but check for the presence
of clock_gettime() in configure.ac and Makefile.am.
Version 1.6.22 [May 26, 2016]
No changes.
Version 1.6.23beta01 [May 29, 2016]
Stop a potential memory leak in png_set_tRNS() (Bug report by Ted Ying).
Fixed the progressive reader to handle empty first IDAT chunk properly
(patch by Timothy Nikkel). This bug was introduced in libpng-1.6.0 and
only affected the libpng16 branch.
Added tests in pngvalid.c to check zero-length IDAT chunks in various
positions. Fixed the sequential reader to handle these more robustly
(John Bowler).
Version 1.6.23rc01 [June 2, 2016]
Corrected progressive read input buffer in pngvalid.c. The previous version
the code invariably passed just one byte at a time to libpng. The intent
was to pass a random number of bytes in the range 0..511.
Moved sse2 prototype from pngpriv.h to contrib/intel/intel_sse.patch.
Added missing ")" in pngerror.c (Matt Sarrett).
Version 1.6.23rc02 [June 4, 2016]
Fixed undefined behavior in png_push_save_buffer(). Do not call
memcpy() with a null source, even if count is zero (Leon Scroggins III).
Version 1.6.23 [June 9, 2016]
Fixed bad link to RFC2083 in png.5 (Nikola Forro).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
...
...
src/share/native/sun/awt/libpng/LICENSE
浏览文件 @
7be585fd
...
...
@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000
, through 1.6.20, December 3, 2015,
are
Copyright (c) 2000-2002, 2004, 2006-201
5
Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000
through 1.6.23, June 9, 2016
are
Copyright (c) 2000-2002, 2004, 2006-201
6
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:
...
...
@@ -32,6 +32,10 @@ and with the following additions to the disclaimer:
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
Some files in the "contrib" directory and some configure-generated
files that are distributed with libpng have other copyright owners and
are released under other open source licenses.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and
...
...
@@ -55,6 +59,9 @@ Contributing Authors:
Greg Roelofs
Tom Tanner
Some files in the "scripts" directory have other copyright owners
but are released under this license.
libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
...
...
@@ -95,18 +102,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 3, 2015
June 9, 2016
src/share/native/sun/awt/libpng/README
浏览文件 @
7be585fd
README for libpng version 1.6.2
0 - December 3, 2015
(shared library 16.0)
README for libpng version 1.6.2
3 - June 9, 2016
(shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
...
...
src/share/native/sun/awt/libpng/png.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.19 [November 12, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
@@ -42,7 +42,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef
png_libpng_version_1_6_2
0
Your_png_h_is_not_version_1_6_20
;
typedef
png_libpng_version_1_6_2
3
Your_png_h_is_not_version_1_6_23
;
/* 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
...
...
@@ -803,14 +803,15 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return
PNG_STRING_NEWLINE
\
"libpng version 1.6.20 - December 3, 2015"
PNG_STRING_NEWLINE
\
"Copyright (c) 1998-2015 Glenn Randers-Pehrson"
PNG_STRING_NEWLINE
\
"libpng version 1.6.23 - June 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.6.2
0 - December 3, 2015
\
Copyright (c) 1998-20
15
Glenn Randers-Pehrson\
return
"libpng version 1.6.2
3 - June 9, 2016
\
Copyright (c) 1998-20
02,2004,2006-2016
Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
;
# endif
...
...
src/share/native/sun/awt/libpng/png.h
浏览文件 @
7be585fd
...
...
@@ -29,9 +29,9 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* libpng version 1.6.2
0, December 3, 2015
* libpng version 1.6.2
3, June 9, 2016
*
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -40,7 +40,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.2
0, December 3, 2015
:
* libpng versions 0.97, January 1998, through 1.6.2
3, June 9, 2016
:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
...
...
@@ -53,8 +53,12 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
* Some files in the "contrib" directory and some configure-generated
* files that are distributed with libpng have other copyright owners and
* are released under other open source licenses.
*
* libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 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:
...
...
@@ -75,6 +79,10 @@
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
* Some files in the "contrib" directory have other copyright owners and
* are released under other open source licenses.
*
*
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
* libpng-0.96, and are distributed according to the same disclaimer and
...
...
@@ -85,6 +93,9 @@
* Glenn Randers-Pehrson
* Willem van Schaik
*
* Some files in the "scripts" directory have different copyright owners
* but are also released under this license.
*
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
* and are distributed according to the same disclaimer and license as
...
...
@@ -98,6 +109,9 @@
* Greg Roelofs
* Tom Tanner
*
* Some files in the "scripts" directory have other copyright owners
* but are released under this license.
*
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
*
...
...
@@ -137,6 +151,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).
*/
/*
...
...
@@ -149,12 +186,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
...
...
@@ -210,11 +241,11 @@
* ...
* 1.0.19 10 10019 10.so.0.19[.0]
* ...
* 1.2.5
3 13 10253 12.so.0.53
[.0]
* 1.2.5
6 13 10256 12.so.0.56
[.0]
* ...
* 1.5.2
3 15 10523 15.so.15.23
[.0]
* 1.5.2
7 15 10527 15.so.15.27
[.0]
* ...
* 1.6.2
0 16 10620 16.so.16.20
[.0]
* 1.6.2
3 16 10623 16.so.16.23
[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
...
...
@@ -242,13 +273,13 @@
* Y2K compliance in libpng:
* =========================
*
*
December 3, 2015
*
June 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.6.2
0
are Y2K compliant. It is my belief that
* upward through 1.6.2
3
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
...
...
@@ -310,9 +341,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.2
0
"
#define PNG_LIBPNG_VER_STRING "1.6.2
3
"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.2
0 - December 3, 2015
\n"
" libpng version 1.6.2
3 - June 9, 2016
\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
...
...
@@ -320,7 +351,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 2
0
#define PNG_LIBPNG_VER_RELEASE 2
3
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
...
...
@@ -351,7 +382,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 1062
0
/* 1.6.20
*/
#define PNG_LIBPNG_VER 1062
3
/* 1.6.23
*/
/* Library configuration: these options cannot be changed after
* the library has been built.
...
...
@@ -461,7 +492,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_6_2
0
;
typedef
char
*
png_libpng_version_1_6_2
3
;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
...
...
@@ -762,24 +793,22 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
* 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 */
#if INT_MAX >= 0x8000
/* else this might break */
#define PNG_INFO_IDAT 0x8000
/* ESR, 1.0.6 */
#endif
#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
...
...
@@ -1350,7 +1379,7 @@ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
#endif
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_16_TO_8
SUPPORTED
/* Name prior to 1.5.4 */
#define PNG_READ_16_TO_8
_
SUPPORTED
/* Name prior to 1.5.4 */
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT
(
48
,
void
,
png_set_strip_16
,
(
png_structrp
png_ptr
));
#endif
...
...
@@ -1501,8 +1530,8 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
#define PNG_FILTER_UP 0x20
#define PNG_FILTER_AVG 0x40
#define PNG_FILTER_PAETH 0x80
#define PNG_
ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
PNG_FILTER_AVG | PNG_FILTER_PAETH)
#define PNG_
FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
#define PNG_ALL_FILTERS (PNG_FAST_FILTERS |
PNG_FILTER_AVG | PNG_FILTER_PAETH)
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.
...
...
@@ -1779,21 +1808,21 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
#define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2
/* Flags for png_ptr->free_me and info_ptr->free_me */
#define PNG_FREE_HIST 0x0008
#define PNG_FREE_ICCP 0x0010
#define PNG_FREE_SPLT 0x0020
#define PNG_FREE_ROWS 0x0040
#define PNG_FREE_PCAL 0x0080
#define PNG_FREE_SCAL 0x0100
#define PNG_FREE_HIST 0x0008
U
#define PNG_FREE_ICCP 0x0010
U
#define PNG_FREE_SPLT 0x0020
U
#define PNG_FREE_ROWS 0x0040
U
#define PNG_FREE_PCAL 0x0080
U
#define PNG_FREE_SCAL 0x0100
U
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_FREE_UNKN 0x0200
# define PNG_FREE_UNKN 0x0200
U
#endif
/* PNG_FREE_LIST 0x0400
removed in 1.6.0 because it is ignored */
#define PNG_FREE_PLTE 0x1000
#define PNG_FREE_TRNS 0x2000
#define PNG_FREE_TEXT 0x4000
#define PNG_FREE_ALL 0x7fff
#define PNG_FREE_MUL 0x4220
/* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
/* PNG_FREE_LIST 0x0400
U
removed in 1.6.0 because it is ignored */
#define PNG_FREE_PLTE 0x1000
U
#define PNG_FREE_TRNS 0x2000
U
#define PNG_FREE_TEXT 0x4000
U
#define PNG_FREE_ALL 0x7fff
U
#define PNG_FREE_MUL 0x4220
U
/* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED
PNG_EXPORTA
(
100
,
png_voidp
,
png_malloc_default
,
(
png_const_structrp
png_ptr
,
...
...
@@ -2917,12 +2946,19 @@ typedef struct
* is the minimum 'row stride', the minimum count of components between each
* row. For a color-mapped image this is the minimum number of bytes in a
* row.
*
* WARNING: this macro overflows for some images with more than one component
* and very large image widths. libpng will refuse to process an image where
* this macro would overflow.
*/
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
(PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
/* Return the size, in bytes, of an image buffer given a png_image and a row
* stride - the number of components to leave space for in each row.
*
* WARNING: this macro overflows a 32-bit integer for some large PNG images,
* libpng will refuse to process an image where such an overflow would occur.
*/
#define PNG_IMAGE_SIZE(image)\
...
...
@@ -3043,7 +3079,6 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
#endif
/* SIMPLIFIED_READ */
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
/* WRITE APIS
* ----------
* For write you must initialize a png_image structure to describe the image to
...
...
@@ -3060,6 +3095,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
* values do not correspond to the colors in sRGB.
* colormap_entries: set to the number of entries in the color-map (0 to 256)
*/
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
PNG_EXPORT
(
239
,
int
,
png_image_write_to_file
,
(
png_imagep
image
,
const
char
*
file
,
int
convert_to_8bit
,
const
void
*
buffer
,
png_int_32
row_stride
,
const
void
*
colormap
));
...
...
@@ -3069,8 +3105,9 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
int
convert_to_8_bit
,
const
void
*
buffer
,
png_int_32
row_stride
,
const
void
*
colormap
));
/* Write the image to the given (FILE*). */
#endif
/* SIMPLIFIED_WRITE_STDIO */
/* With
both
write APIs if image is in one of the linear formats with 16-bit
/* With
all
write APIs if image is in one of the linear formats with 16-bit
* data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
* gamma encoded according to the sRGB specification, otherwise a 16-bit linear
* encoded PNG file is written.
...
...
@@ -3082,13 +3119,103 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
*
* With all APIs row_stride is handled as in the read APIs - it is the spacing
* from one row to the next in component sized units (1 or 2 bytes) and if
* negative indicates a bottom-up row layout in the buffer. If row_stride is zero,
* libpng will calculate it for you from the image width and number of channels.
*
* Note that the write API does not support interlacing, sub-8-bit pixels, indexed
* PNG (color_type 3) or most ancillary chunks.
* negative indicates a bottom-up row layout in the buffer. If row_stride is
* zero, libpng will calculate it for you from the image width and number of
* channels.
*
* Note that the write API does not support interlacing, sub-8-bit pixels or
* most ancillary chunks. If you need to write text chunks (e.g. for copyright
* notices) you need to use one of the other APIs.
*/
PNG_EXPORT
(
245
,
int
,
png_image_write_to_memory
,
(
png_imagep
image
,
void
*
memory
,
png_alloc_size_t
*
PNG_RESTRICT
memory_bytes
,
int
convert_to_8_bit
,
const
void
*
buffer
,
png_int_32
row_stride
,
const
void
*
colormap
));
/* Write the image to the given memory buffer. The function both writes the
* whole PNG data stream to *memory and updates *memory_bytes with the count
* of bytes written.
*
* 'memory' may be NULL. In this case *memory_bytes is not read however on
* success the number of bytes which would have been written will still be
* stored in *memory_bytes. On failure *memory_bytes will contain 0.
*
* If 'memory' is not NULL it must point to memory[*memory_bytes] of
* writeable memory.
*
* If the function returns success memory[*memory_bytes] (if 'memory' is not
* NULL) contains the written PNG data. *memory_bytes will always be less
* than or equal to the original value.
*
* If the function returns false and *memory_bytes was not changed an error
* occured during write. If *memory_bytes was changed, or is not 0 if
* 'memory' was NULL, the write would have succeeded but for the memory
* buffer being too small. *memory_bytes contains the required number of
* bytes and will be bigger that the original value.
*/
#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
row_stride, colormap)\
png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
row_stride, colormap)
/* Return the amount of memory in 'size' required to compress this image.
* The png_image structure 'image' must be filled in as in the above
* function and must not be changed before the actual write call, the buffer
* and all other parameters must also be identical to that in the final
* write call. The 'size' variable need not be initialized.
*
* NOTE: the macro returns true/false, if false is returned 'size' will be
* set to zero and the write failed and probably will fail if tried again.
*/
/* You can pre-allocate the buffer by making sure it is of sufficient size
* regardless of the amount of compression achieved. The buffer size will
* always be bigger than the original image and it will never be filled. The
* following macros are provided to assist in allocating the buffer.
*/
#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
/* The number of uncompressed bytes in the PNG byte encoding of the image;
* uncompressing the PNG IDAT data will give this number of bytes.
*
* NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
* macro can because of the extra bytes used in the PNG byte encoding. You
* need to avoid this macro if your image size approaches 2^30 in width or
* height. The same goes for the remainder of these macros; they all produce
* bigger numbers than the actual in-memory image size.
*/
#ifndef PNG_ZLIB_MAX_SIZE
# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
/* An upper bound on the number of compressed bytes given 'b' uncompressed
* bytes. This is based on deflateBounds() in zlib; different
* implementations of zlib compression may conceivably produce more data so
* if your zlib implementation is not zlib itself redefine this macro
* appropriately.
*/
#endif
#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
/* An upper bound on the size of the data in the PNG IDAT chunks. */
#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
((8U
/*sig*/
+25U
/*IHDR*/
+16U
/*gAMA*/
+44U
/*cHRM*/
+12U
/*IEND*/
+\
(((image).format&PNG_FORMAT_FLAG_COLORMAP)?
/*colormap: PLTE, tRNS*/
\
12U+3U*(image).colormap_entries
/*PLTE data*/
+\
(((image).format&PNG_FORMAT_FLAG_ALPHA)?\
12U
/*tRNS*/
+(image).colormap_entries:0U):0U)+\
12U)+(12U*((image_size)/PNG_ZBUF_SIZE))
/*IDAT*/
+(image_size))
/* A helper for the following macro; if your compiler cannot handle the
* following macro use this one with the result of
* PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
* compilers should handle this just fine.)
*/
#define PNG_IMAGE_PNG_SIZE_MAX(image)\
PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
/* An upper bound on the total length of the PNG data stream for 'image'.
* The result is of type png_alloc_size_t, on 32-bit systems this may
* overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
* run out of buffer space but return a corrected size which should work.
*/
#endif
/* STDIO */
#endif
/* SIMPLIFIED_WRITE */
/*******************************************************************************
* END OF SIMPLIFIED API
...
...
@@ -3146,7 +3273,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL
(
24
4
);
PNG_EXPORT_LAST_ORDINAL
(
24
5
);
#endif
#ifdef __cplusplus
...
...
src/share/native/sun/awt/libpng/pngconf.h
浏览文件 @
7be585fd
...
...
@@ -29,9 +29,9 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* libpng version 1.6.2
0, December 3, 2015
* libpng version 1.6.2
3, June 9, 2016
*
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngdebug.h
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.8 [December 19, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
13 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.)
*
...
...
src/share/native/sun/awt/libpng/pngerror.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
14 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.)
*
...
...
@@ -72,7 +72,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
if
(
png_ptr
!=
NULL
)
{
if
((
png_ptr
->
flags
&
(
PNG_FLAG_STRIP_ERROR_NUMBERS
|
PNG_FLAG_STRIP_ERROR_TEXT
))
!=
0
(
PNG_FLAG_STRIP_ERROR_NUMBERS
|
PNG_FLAG_STRIP_ERROR_TEXT
))
!=
0
)
{
if
(
*
error_message
==
PNG_LITERAL_SHARP
)
{
...
...
src/share/native/sun/awt/libpng/pngget.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.17 [March 26, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pnginfo.h
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.1 [March 28, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
13 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.)
*
...
...
src/share/native/sun/awt/libpng/pnglibconf.h
浏览文件 @
7be585fd
...
...
@@ -27,16 +27,15 @@
/* libpng STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*/
/* libpng version 1.6.2
0, December 3, 2015
*/
/* libpng version 1.6.2
3, June 9, 2016
*/
/* Copyright (c) 1998-201
4
Glenn Randers-Pehrson */
/* Copyright (c) 1998-201
6
Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */
...
...
@@ -141,6 +140,7 @@
#define PNG_SIMPLIFIED_READ_SUPPORTED
/*#undef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED*/
/*#undef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED*/
/*#undef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED*/
/*#undef PNG_SIMPLIFIED_WRITE_SUPPORTED*/
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
...
...
src/share/native/sun/awt/libpng/pngmem.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
14 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.)
*
...
...
src/share/native/sun/awt/libpng/pngpread.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
18 [July 23, 2015
]
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
23 [June 9, 2016
]
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -238,13 +238,15 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
(
png_ptr
->
mode
&
PNG_HAVE_PLTE
)
==
0
)
png_error
(
png_ptr
,
"Missing PLTE before IDAT"
);
png_ptr
->
mode
|=
PNG_HAVE_IDAT
;
png_ptr
->
process_mode
=
PNG_READ_IDAT_MODE
;
if
((
png_ptr
->
mode
&
PNG_HAVE_IDAT
)
!=
0
)
if
((
png_ptr
->
mode
&
PNG_HAVE_CHUNK_AFTER_IDAT
)
==
0
)
if
(
png_ptr
->
push_length
==
0
)
return
;
png_ptr
->
mode
|=
PNG_HAVE_IDAT
;
if
((
png_ptr
->
mode
&
PNG_AFTER_IDAT
)
!=
0
)
png_benign_error
(
png_ptr
,
"Too many IDATs found"
);
}
...
...
@@ -527,7 +529,10 @@ png_push_save_buffer(png_structrp png_ptr)
png_error
(
png_ptr
,
"Insufficient memory for save_buffer"
);
}
if
(
old_buffer
)
memcpy
(
png_ptr
->
save_buffer
,
old_buffer
,
png_ptr
->
save_buffer_size
);
else
if
(
png_ptr
->
save_buffer_size
)
png_error
(
png_ptr
,
"save_buffer error"
);
png_free
(
png_ptr
,
old_buffer
);
png_ptr
->
save_buffer_max
=
new_max
;
}
...
...
src/share/native/sun/awt/libpng/pngpriv.h
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
18 [July 23, 2015
]
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
22 [May 26, 2016
]
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -1945,6 +1945,9 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
#endif
PNG_INTERNAL_FUNCTION
(
png_uint_32
,
png_check_keyword
,
(
png_structrp
png_ptr
,
png_const_charp
key
,
png_bytep
new_key
),
PNG_EMPTY
);
/* Maintainer: Put new private prototypes here ^ */
#include "pngdebug.h"
...
...
src/share/native/sun/awt/libpng/pngread.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
17 [March 26, 2015
]
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
23 [June 9, 2016
]
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -155,7 +155,10 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
}
else
if
((
png_ptr
->
mode
&
PNG_HAVE_IDAT
)
!=
0
)
{
png_ptr
->
mode
|=
PNG_HAVE_CHUNK_AFTER_IDAT
;
png_ptr
->
mode
|=
PNG_AFTER_IDAT
;
}
/* This should be a binary subdivision search or a hash for
* matching the chunk name rather than a linear search.
...
...
@@ -813,6 +816,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_uint_32
length
=
png_read_chunk_header
(
png_ptr
);
png_uint_32
chunk_name
=
png_ptr
->
chunk_name
;
if
(
chunk_name
!=
png_IDAT
)
png_ptr
->
mode
|=
PNG_HAVE_CHUNK_AFTER_IDAT
;
if
(
chunk_name
==
png_IEND
)
png_handle_IEND
(
png_ptr
,
info_ptr
,
length
);
...
...
@@ -827,9 +833,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
{
if
(
chunk_name
==
png_IDAT
)
{
if
((
length
>
0
)
||
(
png_ptr
->
mode
&
PNG_HAVE_CHUNK_AFTER_IDAT
)
!=
0
)
png_benign_error
(
png_ptr
,
"Too many IDATs found"
);
if
((
length
>
0
&&
!
(
png_ptr
->
flags
&
PNG_FLAG_ZSTREAM_ENDED
))
||
(
png_ptr
->
mode
&
PNG_HAVE_CHUNK_AFTER_IDAT
)
!=
0
)
png_benign_error
(
png_ptr
,
"
.
Too many IDATs found"
);
}
png_handle_unknown
(
png_ptr
,
info_ptr
,
length
,
keep
);
if
(
chunk_name
==
png_PLTE
)
...
...
@@ -840,10 +846,14 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
else
if
(
chunk_name
==
png_IDAT
)
{
/* Zero length IDATs are legal after the last IDAT has been
* read, but not after other chunks have been read.
* read, but not after other chunks have been read. 1.6 does not
* always read all the deflate data; specifically it cannot be relied
* upon to read the Adler32 at the end. If it doesn't ignore IDAT
* chunks which are longer than zero as well:
*/
if
((
length
>
0
)
||
(
png_ptr
->
mode
&
PNG_HAVE_CHUNK_AFTER_IDAT
)
!=
0
)
png_benign_error
(
png_ptr
,
"Too many IDATs found"
);
if
((
length
>
0
&&
!
(
png_ptr
->
flags
&
PNG_FLAG_ZSTREAM_ENDED
))
||
(
png_ptr
->
mode
&
PNG_HAVE_CHUNK_AFTER_IDAT
)
!=
0
)
png_benign_error
(
png_ptr
,
"..Too many IDATs found"
);
png_crc_finish
(
png_ptr
,
length
);
}
...
...
@@ -3876,7 +3886,7 @@ png_image_read_direct(png_voidp argument)
else
filler
=
255
;
#
ifdef PNG_FORMAT_AFIRST_SUPPORTED
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
if
((
format
&
PNG_FORMAT_FLAG_AFIRST
)
!=
0
)
{
where
=
PNG_FILLER_BEFORE
;
...
...
@@ -3884,7 +3894,7 @@ png_image_read_direct(png_voidp argument)
}
else
#
endif
#endif
where
=
PNG_FILLER_AFTER
;
png_set_add_alpha
(
png_ptr
,
filler
,
where
);
...
...
@@ -3993,12 +4003,12 @@ png_image_read_direct(png_voidp argument)
if
(
info_ptr
->
bit_depth
==
16
)
info_format
|=
PNG_FORMAT_FLAG_LINEAR
;
#
ifdef PNG_FORMAT_BGR_SUPPORTED
#ifdef PNG_FORMAT_BGR_SUPPORTED
if
((
png_ptr
->
transformations
&
PNG_BGR
)
!=
0
)
info_format
|=
PNG_FORMAT_FLAG_BGR
;
#
endif
#endif
#
ifdef PNG_FORMAT_AFIRST_SUPPORTED
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
if
(
do_local_background
==
2
)
{
if
((
format
&
PNG_FORMAT_FLAG_AFIRST
)
!=
0
)
...
...
@@ -4098,11 +4108,20 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
void
*
buffer
,
png_int_32
row_stride
,
void
*
colormap
)
{
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
/* Check for row_stride overflow. This check is not performed on the
* original PNG format because it may not occur in the output PNG format
* and libpng deals with the issues of reading the original.
*/
const
unsigned
int
channels
=
PNG_IMAGE_PIXEL_CHANNELS
(
image
->
format
);
if
(
image
->
width
<=
0x7FFFFFFFU
/
channels
)
/* no overflow */
{
png_uint_32
check
;
const
png_uint_32
png_row_stride
=
image
->
width
*
channels
;
if
(
row_stride
==
0
)
row_stride
=
PNG_IMAGE_ROW_STRIDE
(
*
image
)
;
row_stride
=
(
png_int_32
)
/*SAFE*/
png_row_stride
;
if
(
row_stride
<
0
)
check
=
-
row_stride
;
...
...
@@ -4110,8 +4129,13 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
else
check
=
row_stride
;
if
(
image
->
opaque
!=
NULL
&&
buffer
!=
NULL
&&
check
>=
PNG_IMAGE_ROW_STRIDE
(
*
image
))
if
(
image
->
opaque
!=
NULL
&&
buffer
!=
NULL
&&
check
>=
png_row_stride
)
{
/* Now check for overflow of the image buffer calculation; this
* limits the whole image size to 32 bits for API compatibility with
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
*/
if
(
image
->
height
<=
0xFFFFFFFF
/
png_row_stride
)
{
if
((
image
->
format
&
PNG_FORMAT_FLAG_COLORMAP
)
==
0
||
(
image
->
colormap_entries
>
0
&&
colormap
!=
NULL
))
...
...
@@ -4127,17 +4151,19 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
display
.
background
=
background
;
display
.
local_row
=
NULL
;
/* Choose the correct 'end' routine; for the color-map case all th
e
*
setup has already been done.
/* Choose the correct 'end' routine; for the color-map cas
e
* all the
setup has already been done.
*/
if
((
image
->
format
&
PNG_FORMAT_FLAG_COLORMAP
)
!=
0
)
result
=
png_safe_execute
(
image
,
png_image_read_colormap
,
&
display
)
&&
png_safe_execute
(
image
,
png_image_read_colormapped
,
&
display
);
result
=
png_safe_execute
(
image
,
png_image_read_colormap
,
&
display
)
&&
png_safe_execute
(
image
,
png_image_read_colormapped
,
&
display
);
else
result
=
png_safe_execute
(
image
,
png_image_read_direct
,
&
display
);
png_safe_execute
(
image
,
png_image_read_direct
,
&
display
);
png_image_free
(
image
);
return
result
;
...
...
@@ -4148,11 +4174,21 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
"png_image_finish_read[color-map]: no color-map"
);
}
else
return
png_image_error
(
image
,
"png_image_finish_read: image too large"
);
}
else
return
png_image_error
(
image
,
"png_image_finish_read: invalid argument"
);
}
else
return
png_image_error
(
image
,
"png_image_finish_read: row_stride too large"
);
}
else
if
(
image
!=
NULL
)
return
png_image_error
(
image
,
"png_image_finish_read: damaged PNG_IMAGE_VERSION"
);
...
...
src/share/native/sun/awt/libpng/pngrio.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.17 [March 26, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngrtran.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
19 [November 12, 2015
]
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
22 [May 26, 2016
]
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -317,9 +317,12 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
* is expected to be 1 or greater, but this range test allows for some
* viewing correction values. The intent is to weed out users of this API
* who use the inverse of the gamma value accidentally! Since some of these
* values are reasonable this may have to be changed.
* values are reasonable this may have to be changed:
*
* 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
* gamma of 36, and its reciprocal.)
*/
if
(
output_gamma
<
70000
||
output_gamma
>
3
00000
)
if
(
output_gamma
<
1000
||
output_gamma
>
100
00000
)
png_error
(
png_ptr
,
"output gamma out of expected range"
);
/* The default file gamma is the inverse of the output gamma; the output
...
...
src/share/native/sun/awt/libpng/pngrutil.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.20 [December 3, 201
5
]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Last changed in libpng 1.6.20 [December 3, 201
4
]
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngset.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
19 [November 12, 2015
]
* Copyright (c) 1998-201
5
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
23 [June 9, 2016
]
* Copyright (c) 1998-201
6
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.)
*
...
...
@@ -980,13 +980,15 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
png_free_data
(
png_ptr
,
info_ptr
,
PNG_FREE_TRNS
,
0
);
if
(
num_trans
>
0
&&
num_trans
<=
PNG_MAX_PALETTE_LENGTH
)
{
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr
->
trans_alpha
=
info_ptr
->
trans_alpha
=
png_voidcast
(
png_bytep
,
info_ptr
->
trans_alpha
=
png_voidcast
(
png_bytep
,
png_malloc
(
png_ptr
,
PNG_MAX_PALETTE_LENGTH
));
if
(
num_trans
>
0
&&
num_trans
<=
PNG_MAX_PALETTE_LENGTH
)
memcpy
(
info_ptr
->
trans_alpha
,
trans_alpha
,
(
png_size_t
)
num_trans
);
}
png_ptr
->
trans_alpha
=
info_ptr
->
trans_alpha
;
}
if
(
trans_color
!=
NULL
)
{
...
...
@@ -1672,4 +1674,88 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
png_ptr
->
num_palette_max
=
-
1
;
}
#endif
#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 png_error.
*/
png_uint_32
/* PRIVATE */
png_check_keyword
(
png_structrp
png_ptr
,
png_const_charp
key
,
png_bytep
new_key
)
{
png_const_charp
orig_key
=
key
;
png_uint_32
key_len
=
0
;
int
bad_character
=
0
;
int
space
=
1
;
png_debug
(
1
,
"in png_check_keyword"
);
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 the character was not a space then it is invalid. */
if
(
ch
!=
32
)
bad_character
=
ch
;
}
else
if
(
bad_character
==
0
)
bad_character
=
ch
;
/* just skip it, record the first error */
}
if
(
key_len
>
0
&&
space
!=
0
)
/* trailing space */
{
--
key_len
,
--
new_key
;
if
(
bad_character
==
0
)
bad_character
=
32
;
}
/* Terminate the keyword */
*
new_key
=
0
;
if
(
key_len
==
0
)
return
0
;
#ifdef PNG_WARNINGS_SUPPORTED
/* Try to only output one warning per keyword: */
if
(
*
key
!=
0
)
/* keyword too long */
png_warning
(
png_ptr
,
"keyword truncated"
);
else
if
(
bad_character
!=
0
)
{
PNG_WARNING_PARAMETERS
(
p
)
png_warning_parameter
(
p
,
1
,
orig_key
);
png_warning_parameter_signed
(
p
,
2
,
PNG_NUMBER_FORMAT_02x
,
bad_character
);
png_formatted_warning
(
png_ptr
,
p
,
"keyword
\"
@1
\"
: bad character '0x@2'"
);
}
#endif
/* WARNINGS */
return
key_len
;
}
#endif
/* TEXT || pCAL || iCCP || sPLT */
#endif
/* READ || WRITE */
src/share/native/sun/awt/libpng/pngstruct.h
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.18 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngtest.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.5.25 [December 3, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
@@ -71,6 +71,15 @@
#include "png.h"
/* 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 && defined(HAVE_CONFIG_H)
# define SKIP 77
#else
# define SKIP 0
#endif
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
* simply as a result of re-ordering them. This may be fixed in 1.7
*
...
...
@@ -2093,9 +2102,9 @@ main(void)
fprintf
(
STDERR
,
" test ignored because libpng was not built with read support
\n
"
);
/* And skip this test */
return
PNG_LIBPNG_VER
<
10600
?
0
:
77
;
return
SKIP
;
}
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
typedef
png_libpng_version_1_6_2
0
Your_png_h_is_not_version_1_6_20
;
typedef
png_libpng_version_1_6_2
3
Your_png_h_is_not_version_1_6_23
;
src/share/native/sun/awt/libpng/pngtrans.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.18 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngwio.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
14 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.)
*
...
...
src/share/native/sun/awt/libpng/pngwrite.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.19 [November 12, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
@@ -40,9 +40,9 @@
*/
#include "pngpriv.h"
#if
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
#if
def PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
# include <errno.h>
#endif
#endif
/* SIMPLIFIED_WRITE_STDIO */
#ifdef PNG_WRITE_SUPPORTED
...
...
@@ -1480,7 +1480,6 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
/* currently required for png_image_write_* */
/* Initialize the write structure - general purpose utility. */
static
int
png_image_write_init
(
png_imagep
image
)
...
...
@@ -1532,6 +1531,10 @@ typedef struct
png_const_voidp
first_row
;
ptrdiff_t
row_bytes
;
png_voidp
local_row
;
/* Byte count for memory writing */
png_bytep
memory
;
png_alloc_size_t
memory_bytes
;
/* not used for STDIO */
png_alloc_size_t
output_bytes
;
/* running total */
}
png_image_write_control
;
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
...
...
@@ -1959,9 +1962,43 @@ png_image_write_main(png_voidp argument)
png_set_benign_errors
(
png_ptr
,
0
/*error*/
);
# endif
/* Default the 'row_stride' parameter if required. */
/* Default the 'row_stride' parameter if required, also check the row stride
* and total image size to ensure that they are within the system limits.
*/
{
const
unsigned
int
channels
=
PNG_IMAGE_PIXEL_CHANNELS
(
image
->
format
);
if
(
image
->
width
<=
0x7FFFFFFFU
/
channels
)
/* no overflow */
{
png_uint_32
check
;
const
png_uint_32
png_row_stride
=
image
->
width
*
channels
;
if
(
display
->
row_stride
==
0
)
display
->
row_stride
=
PNG_IMAGE_ROW_STRIDE
(
*
image
);
display
->
row_stride
=
(
png_int_32
)
/*SAFE*/
png_row_stride
;
if
(
display
->
row_stride
<
0
)
check
=
-
display
->
row_stride
;
else
check
=
display
->
row_stride
;
if
(
check
>=
png_row_stride
)
{
/* Now check for overflow of the image buffer calculation; this
* limits the whole image size to 32 bits for API compatibility with
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
*/
if
(
image
->
height
>
0xFFFFFFFF
/
png_row_stride
)
png_error
(
image
->
opaque
->
png_ptr
,
"memory image too large"
);
}
else
png_error
(
image
->
opaque
->
png_ptr
,
"supplied row stride too small"
);
}
else
png_error
(
image
->
opaque
->
png_ptr
,
"image row stride too large"
);
}
/* Set the required transforms then write the rows in the correct order. */
if
((
format
&
PNG_FORMAT_FLAG_COLORMAP
)
!=
0
)
...
...
@@ -2138,6 +2175,122 @@ png_image_write_main(png_voidp argument)
return
1
;
}
static
void
(
PNGCBAPI
image_memory_write
)(
png_structp
png_ptr
,
png_bytep
/*const*/
data
,
png_size_t
size
)
{
png_image_write_control
*
display
=
png_voidcast
(
png_image_write_control
*
,
png_ptr
->
io_ptr
/*backdoor: png_get_io_ptr(png_ptr)*/
);
const
png_alloc_size_t
ob
=
display
->
output_bytes
;
/* Check for overflow; this should never happen: */
if
(
size
<=
((
png_alloc_size_t
)
-
1
)
-
ob
)
{
/* I don't think libpng ever does this, but just in case: */
if
(
size
>
0
)
{
if
(
display
->
memory_bytes
>=
ob
+
size
)
/* writing */
memcpy
(
display
->
memory
+
ob
,
data
,
size
);
/* Always update the size: */
display
->
output_bytes
=
ob
+
size
;
}
}
else
png_error
(
png_ptr
,
"png_image_write_to_memory: PNG too big"
);
}
static
void
(
PNGCBAPI
image_memory_flush
)(
png_structp
png_ptr
)
{
PNG_UNUSED
(
png_ptr
)
}
static
int
png_image_write_memory
(
png_voidp
argument
)
{
png_image_write_control
*
display
=
png_voidcast
(
png_image_write_control
*
,
argument
);
/* The rest of the memory-specific init and write_main in an error protected
* environment. This case needs to use callbacks for the write operations
* since libpng has no built in support for writing to memory.
*/
png_set_write_fn
(
display
->
image
->
opaque
->
png_ptr
,
display
/*io_ptr*/
,
image_memory_write
,
image_memory_flush
);
return
png_image_write_main
(
display
);
}
int
PNGAPI
png_image_write_to_memory
(
png_imagep
image
,
void
*
memory
,
png_alloc_size_t
*
PNG_RESTRICT
memory_bytes
,
int
convert_to_8bit
,
const
void
*
buffer
,
png_int_32
row_stride
,
const
void
*
colormap
)
{
/* Write the image to the given buffer, or count the bytes if it is NULL */
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
if
(
memory_bytes
!=
NULL
&&
buffer
!=
NULL
)
{
/* This is to give the caller an easier error detection in the NULL
* case and guard against uninitialized variable problems:
*/
if
(
memory
==
NULL
)
*
memory_bytes
=
0
;
if
(
png_image_write_init
(
image
)
!=
0
)
{
png_image_write_control
display
;
int
result
;
memset
(
&
display
,
0
,
(
sizeof
display
));
display
.
image
=
image
;
display
.
buffer
=
buffer
;
display
.
row_stride
=
row_stride
;
display
.
colormap
=
colormap
;
display
.
convert_to_8bit
=
convert_to_8bit
;
display
.
memory
=
png_voidcast
(
png_bytep
,
memory
);
display
.
memory_bytes
=
*
memory_bytes
;
display
.
output_bytes
=
0
;
result
=
png_safe_execute
(
image
,
png_image_write_memory
,
&
display
);
png_image_free
(
image
);
/* write_memory returns true even if we ran out of buffer. */
if
(
result
)
{
/* On out-of-buffer this function returns '0' but still updates
* memory_bytes:
*/
if
(
memory
!=
NULL
&&
display
.
output_bytes
>
*
memory_bytes
)
result
=
0
;
*
memory_bytes
=
display
.
output_bytes
;
}
return
result
;
}
else
return
0
;
}
else
return
png_image_error
(
image
,
"png_image_write_to_memory: invalid argument"
);
}
else
if
(
image
!=
NULL
)
return
png_image_error
(
image
,
"png_image_write_to_memory: incorrect PNG_IMAGE_VERSION"
);
else
return
0
;
}
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
int
PNGAPI
png_image_write_to_stdio
(
png_imagep
image
,
FILE
*
file
,
int
convert_to_8bit
,
const
void
*
buffer
,
png_int_32
row_stride
,
const
void
*
colormap
)
...
...
@@ -2145,7 +2298,7 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
/* Write the image to the given (FILE*). */
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
if
(
file
!=
NULL
)
if
(
file
!=
NULL
&&
buffer
!=
NULL
)
{
if
(
png_image_write_init
(
image
)
!=
0
)
{
...
...
@@ -2195,7 +2348,7 @@ png_image_write_to_file(png_imagep image, const char *file_name,
/* Write the image to the named file. */
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
if
(
file_name
!=
NULL
)
if
(
file_name
!=
NULL
&&
buffer
!=
NULL
)
{
FILE
*
fp
=
fopen
(
file_name
,
"wb"
);
...
...
@@ -2253,6 +2406,6 @@ png_image_write_to_file(png_imagep image, const char *file_name,
else
return
0
;
}
#
endif
/*
STDIO */
#
endif
/* SIMPLIFIED_WRITE_
STDIO */
#endif
/* SIMPLIFIED_WRITE */
#endif
/* WRITE */
src/share/native/sun/awt/libpng/pngwtran.c
浏览文件 @
7be585fd
...
...
@@ -30,7 +30,7 @@
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.18 [July 23, 2015]
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-20
02,2004,2006-20
15 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.)
*
...
...
src/share/native/sun/awt/libpng/pngwutil.c
浏览文件 @
7be585fd
...
...
@@ -29,8 +29,8 @@
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.6.
19 [November 12, 2015
]
* Copyright (c) 1998-20
15
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
22 [May 26, 2016
]
* Copyright (c) 1998-20
02,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.)
*
...
...
@@ -51,10 +51,10 @@
void
PNGAPI
png_save_uint_32
(
png_bytep
buf
,
png_uint_32
i
)
{
buf
[
0
]
=
(
png_byte
)(
i
>>
24
);
buf
[
1
]
=
(
png_byte
)(
i
>>
16
);
buf
[
2
]
=
(
png_byte
)(
i
>>
8
);
buf
[
3
]
=
(
png_byte
)(
i
);
buf
[
0
]
=
(
png_byte
)(
(
i
>>
24
)
&
0xffU
);
buf
[
1
]
=
(
png_byte
)(
(
i
>>
16
)
&
0xffU
);
buf
[
2
]
=
(
png_byte
)(
(
i
>>
8
)
&
0xffU
);
buf
[
3
]
=
(
png_byte
)(
i
&
0xffU
);
}
/* Place a 16-bit number into a buffer in PNG byte order.
...
...
@@ -64,8 +64,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
void
PNGAPI
png_save_uint_16
(
png_bytep
buf
,
unsigned
int
i
)
{
buf
[
0
]
=
(
png_byte
)(
i
>>
8
);
buf
[
1
]
=
(
png_byte
)(
i
);
buf
[
0
]
=
(
png_byte
)(
(
i
>>
8
)
&
0xffU
);
buf
[
1
]
=
(
png_byte
)(
i
&
0xffU
);
}
#endif
...
...
@@ -693,90 +693,6 @@ png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
}
#endif
/* WRITE_COMPRESSED_TEXT */
#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' 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 png_error.
*/
static
png_uint_32
png_check_keyword
(
png_structrp
png_ptr
,
png_const_charp
key
,
png_bytep
new_key
)
{
png_const_charp
orig_key
=
key
;
png_uint_32
key_len
=
0
;
int
bad_character
=
0
;
int
space
=
1
;
png_debug
(
1
,
"in png_check_keyword"
);
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 the character was not a space then it is invalid. */
if
(
ch
!=
32
)
bad_character
=
ch
;
}
else
if
(
bad_character
==
0
)
bad_character
=
ch
;
/* just skip it, record the first error */
}
if
(
key_len
>
0
&&
space
!=
0
)
/* trailing space */
{
--
key_len
,
--
new_key
;
if
(
bad_character
==
0
)
bad_character
=
32
;
}
/* Terminate the keyword */
*
new_key
=
0
;
if
(
key_len
==
0
)
return
0
;
#ifdef PNG_WARNINGS_SUPPORTED
/* Try to only output one warning per keyword: */
if
(
*
key
!=
0
)
/* keyword too long */
png_warning
(
png_ptr
,
"keyword truncated"
);
else
if
(
bad_character
!=
0
)
{
PNG_WARNING_PARAMETERS
(
p
)
png_warning_parameter
(
p
,
1
,
orig_key
);
png_warning_parameter_signed
(
p
,
2
,
PNG_NUMBER_FORMAT_02x
,
bad_character
);
png_formatted_warning
(
png_ptr
,
p
,
"keyword
\"
@1
\"
: bad character '0x@2'"
);
}
#endif
/* WARNINGS */
return
key_len
;
}
#endif
/* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
/* Write the IHDR chunk, and update the png_struct with the necessary
* information. Note that the rest of this code depends upon this
* information being correct.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录