Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a4517b4b
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看板
提交
a4517b4b
编写于
8月 01, 2018
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8208353: Upgrade JDK 8u to libpng 1.6.35
Reviewed-by: serb, jdv
上级
c86faaf6
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
1920 addition
and
1157 deletion
+1920
-1157
src/share/native/sun/awt/libpng/CHANGES
src/share/native/sun/awt/libpng/CHANGES
+285
-18
src/share/native/sun/awt/libpng/LICENSE
src/share/native/sun/awt/libpng/LICENSE
+5
-3
src/share/native/sun/awt/libpng/README
src/share/native/sun/awt/libpng/README
+12
-8
src/share/native/sun/awt/libpng/png.c
src/share/native/sun/awt/libpng/png.c
+135
-55
src/share/native/sun/awt/libpng/png.h
src/share/native/sun/awt/libpng/png.h
+68
-53
src/share/native/sun/awt/libpng/pngconf.h
src/share/native/sun/awt/libpng/pngconf.h
+15
-14
src/share/native/sun/awt/libpng/pngerror.c
src/share/native/sun/awt/libpng/pngerror.c
+4
-4
src/share/native/sun/awt/libpng/pngget.c
src/share/native/sun/awt/libpng/pngget.c
+39
-9
src/share/native/sun/awt/libpng/pnginfo.h
src/share/native/sun/awt/libpng/pnginfo.h
+15
-7
src/share/native/sun/awt/libpng/pnglibconf.h
src/share/native/sun/awt/libpng/pnglibconf.h
+7
-2
src/share/native/sun/awt/libpng/pngpread.c
src/share/native/sun/awt/libpng/pngpread.c
+20
-19
src/share/native/sun/awt/libpng/pngpriv.h
src/share/native/sun/awt/libpng/pngpriv.h
+157
-37
src/share/native/sun/awt/libpng/pngread.c
src/share/native/sun/awt/libpng/pngread.c
+33
-11
src/share/native/sun/awt/libpng/pngrio.c
src/share/native/sun/awt/libpng/pngrio.c
+6
-6
src/share/native/sun/awt/libpng/pngrtran.c
src/share/native/sun/awt/libpng/pngrtran.c
+799
-800
src/share/native/sun/awt/libpng/pngrutil.c
src/share/native/sun/awt/libpng/pngrutil.c
+211
-67
src/share/native/sun/awt/libpng/pngset.c
src/share/native/sun/awt/libpng/pngset.c
+64
-13
src/share/native/sun/awt/libpng/pngstruct.h
src/share/native/sun/awt/libpng/pngstruct.h
+11
-11
src/share/native/sun/awt/libpng/pngtrans.c
src/share/native/sun/awt/libpng/pngtrans.c
+34
-20
未找到文件。
src/share/native/sun/awt/libpng/CHANGES
浏览文件 @
a4517b4b
此差异已折叠。
点击以展开。
src/share/native/sun/awt/libpng/LICENSE
浏览文件 @
a4517b4b
...
...
@@ -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.
28, January 5, 2017
are
Copyright (c) 2000-2002, 2004, 2006-201
7
Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000 through 1.6.
35, July 15, 2018
are
Copyright (c) 2000-2002, 2004, 2006-201
8
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:
...
...
@@ -23,6 +23,8 @@ added to the list of Contributing Authors:
Gilles Vollant
James Yu
Mandar Sahastrabuddhe
Google Inc.
Vadim Barkov
and with the following additions to the disclaimer:
...
...
@@ -128,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
J
anuary 5, 2017
J
uly 15, 2018
src/share/native/sun/awt/libpng/README
浏览文件 @
a4517b4b
README for libpng version 1.6.
28 - January 5, 2017
(shared library 16.0)
README for libpng version 1.6.
35 - July 15, 2018
(shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
...
...
@@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the
png_uint_32, which will affect shared-library applications that use
this function.
To avoid problems with changes to the internals of png info_struct,
To avoid problems with changes to the internals of
the
png info_struct,
new APIs have been made available in 0.95 to avoid direct application
access to info_ptr. These functions are the png_set_<chunk> and
png_get_<chunk> functions. These functions should be used when
...
...
@@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net.
You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/
documents/
these at http://www.libpng.org/pub/png/
pngdocs.html .
This code is currently being archived at libpng.s
f.net
in the
[DOWNLOAD] area, and at
ftp://ftp.simplesystems.org. If you can't find it
in any of those places, e-mail me, and I'll help you find it.
This code is currently being archived at libpng.s
ourceforge.io
in the
[DOWNLOAD] area, and at
http://libpng.download/src . If you
can't find it
in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
...
...
@@ -118,7 +118,7 @@ development group.
Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net
to subscribe)
.
You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will
...
...
@@ -179,14 +179,16 @@ Files in this distribution:
pngwtran.c => Write data transformations
pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform
powerpc => Contains optimized code for the PowerPC platform
contrib => Contributions
arm-neon => Optimized code for ARM-NEON platform
powerpc-vsx => Optimized code for POWERPC-VSX platform
examples => Example programs
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
intel => Optimized code for INTEL-SSE2 platform
libtests => Test programs
mips-msa => Optimized code for MIPS-MSA platform
pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs
...
...
@@ -194,6 +196,8 @@ Files in this distribution:
testpngs
tools => Various tools
visupng => Contains a MSVC workspace for VisualPng
intel => Optimized code for INTEL-SSE2 platform
mips => Optimized code for MIPS platform
projects => Contains project files and workspaces for
building a DLL
owatcom => Contains a WATCOM project for building libpng
...
...
src/share/native/sun/awt/libpng/png.c
浏览文件 @
a4517b4b
...
...
@@ -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.
28 [January 5, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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,27 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef
png_libpng_version_1_6_28
Your_png_h_is_not_version_1_6_28
;
typedef
png_libpng_version_1_6_35
Your_png_h_is_not_version_1_6_35
;
#ifdef __GNUC__
/* The version tests may need to be added to, but the problem warning has
* consistently been fixed in GCC versions which obtain wide-spread release.
* The problem is that many versions of GCC rearrange comparison expressions in
* the optimizer in such a way that the results of the comparison will change
* if signed integer overflow occurs. Such comparisons are not permitted in
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
* machine architecture so the warning comes and goes unpredictably and is
* impossible to "fix", even were that a good idea.
*/
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
#define GCC_STRICT_OVERFLOW 1
#endif
/* GNU 7.1.x */
#endif
/* GNU */
#ifndef GCC_STRICT_OVERFLOW
#define GCC_STRICT_OVERFLOW 0
#endif
/* 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
...
...
@@ -79,7 +99,7 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
* PNG signature (this is the same behavior as strcmp, memcmp, etc).
*/
int
PNGAPI
png_sig_cmp
(
png_const_bytep
sig
,
png_size_t
start
,
png_
size_t
num_to_check
)
png_sig_cmp
(
png_const_bytep
sig
,
size_t
start
,
size_t
num_to_check
)
{
png_byte
png_signature
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
...
...
@@ -144,7 +164,7 @@ png_reset_crc(png_structrp png_ptr)
* trouble of calculating it.
*/
void
/* PRIVATE */
png_calculate_crc
(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
png_
size_t
length
)
png_calculate_crc
(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
size_t
length
)
{
int
need_crc
=
1
;
...
...
@@ -429,7 +449,7 @@ png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
* those cases where it does anything other than a memset.
*/
PNG_FUNCTION
(
void
,
PNGAPI
png_info_init_3
,(
png_infopp
ptr_ptr
,
png_
size_t
png_info_struct_size
),
png_info_init_3
,(
png_infopp
ptr_ptr
,
size_t
png_info_struct_size
),
PNG_DEPRECATED
)
{
png_inforp
info_ptr
=
*
ptr_ptr
;
...
...
@@ -623,6 +643,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
}
#endif
#ifdef PNG_eXIf_SUPPORTED
/* Free any eXIf entry */
if
(((
mask
&
PNG_FREE_EXIF
)
&
info_ptr
->
free_me
)
!=
0
)
{
# ifdef PNG_READ_eXIf_SUPPORTED
if
(
info_ptr
->
eXIf_buf
)
{
png_free
(
png_ptr
,
info_ptr
->
eXIf_buf
);
info_ptr
->
eXIf_buf
=
NULL
;
}
# endif
if
(
info_ptr
->
exif
)
{
png_free
(
png_ptr
,
info_ptr
->
exif
);
info_ptr
->
exif
=
NULL
;
}
info_ptr
->
valid
&=
~
PNG_INFO_eXIf
;
}
#endif
#ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */
if
(((
mask
&
PNG_FREE_HIST
)
&
info_ptr
->
free_me
)
!=
0
)
...
...
@@ -804,15 +844,15 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return
PNG_STRING_NEWLINE
\
"libpng version 1.6.
28 - January 5, 2017
"
PNG_STRING_NEWLINE
\
"Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson"
\
"libpng version 1.6.
35 - July 15, 2018
"
PNG_STRING_NEWLINE
\
"Copyright (c) 1998-2002,2004,2006-201
8
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.
28 - January 5, 2017
\
Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson\
return
"libpng version 1.6.
35 - July 15, 2018
\
Copyright (c) 1998-2002,2004,2006-201
8
Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
;
# endif
...
...
@@ -930,7 +970,7 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
/* The code is the fifth byte after each four byte string. Historically this
* code was always searched from the end of the list, this is no longer
* necessary because the 'set' routine handles duplicate entries correcty.
* necessary because the 'set' routine handles duplicate entries correct
l
y.
*/
do
/* num_chunk_list > 0, so at least one */
{
...
...
@@ -1901,12 +1941,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
if
(
intent
<
0
||
intent
>=
PNG_sRGB_INTENT_LAST
)
return
png_icc_profile_error
(
png_ptr
,
colorspace
,
"sRGB"
,
(
unsigned
)
intent
,
"invalid sRGB rendering intent"
);
(
png_alloc_size_t
)
intent
,
"invalid sRGB rendering intent"
);
if
((
colorspace
->
flags
&
PNG_COLORSPACE_HAVE_INTENT
)
!=
0
&&
colorspace
->
rendering_intent
!=
intent
)
return
png_icc_profile_error
(
png_ptr
,
colorspace
,
"sRGB"
,
(
unsigned
)
intent
,
"inconsistent rendering intents"
);
(
png_alloc_size_t
)
intent
,
"inconsistent rendering intents"
);
if
((
colorspace
->
flags
&
PNG_COLORSPACE_FROM_sRGB
)
!=
0
)
{
...
...
@@ -1967,7 +2007,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
if
(
profile_length
<
132
)
return
png_icc_profile_error
(
png_ptr
,
colorspace
,
name
,
profile_length
,
"too short"
);
return
1
;
}
...
...
@@ -2056,7 +2095,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
/* Data checks (could be skipped). These checks must be independent of the
* version number; however, the version number doesn't accomodate changes in
* version number; however, the version number doesn't accom
m
odate changes in
* the header fields (just the known tags and the interpretation of the
* data.)
*/
...
...
@@ -2212,22 +2251,23 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
* being in range. All defined tag types have an 8 byte header - a 4 byte
* type signature then 0.
*/
/* This is a hard error; potentially it can cause read outside the
* profile.
*/
if
(
tag_start
>
profile_length
||
tag_length
>
profile_length
-
tag_start
)
return
png_icc_profile_error
(
png_ptr
,
colorspace
,
name
,
tag_id
,
"ICC profile tag outside profile"
);
if
((
tag_start
&
3
)
!=
0
)
{
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this
,
it is
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this
;
it is
* only a warning here because libpng does not care about the
* alignment.
*/
(
void
)
png_icc_profile_error
(
png_ptr
,
NULL
,
name
,
tag_id
,
"ICC profile tag start not a multiple of 4"
);
}
/* This is a hard error; potentially it can cause read outside the
* profile.
*/
if
(
tag_start
>
profile_length
||
tag_length
>
profile_length
-
tag_start
)
return
png_icc_profile_error
(
png_ptr
,
colorspace
,
name
,
tag_id
,
"ICC profile tag outside profile"
);
}
return
1
;
/* success, maybe with warnings */
...
...
@@ -2695,7 +2735,7 @@ png_check_IHDR(png_const_structrp png_ptr,
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* ASCII to fp functions */
/* Check an ASCII formated floating point value, see the more detailed
/* Check an ASCII format
t
ed floating point value, see the more detailed
* comments in pngpriv.h
*/
/* The following is used internally to preserve the sticky flags */
...
...
@@ -2703,11 +2743,11 @@ png_check_IHDR(png_const_structrp png_ptr,
#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
int
/* PRIVATE */
png_check_fp_number
(
png_const_charp
string
,
png_
size_t
size
,
int
*
statep
,
png_check_fp_number
(
png_const_charp
string
,
size_t
size
,
int
*
statep
,
png_size_tp
whereami
)
{
int
state
=
*
statep
;
png_
size_t
i
=
*
whereami
;
size_t
i
=
*
whereami
;
while
(
i
<
size
)
{
...
...
@@ -2830,10 +2870,10 @@ PNG_FP_End:
/* The same but for a complete string. */
int
png_check_fp_string
(
png_const_charp
string
,
png_
size_t
size
)
png_check_fp_string
(
png_const_charp
string
,
size_t
size
)
{
int
state
=
0
;
png_
size_t
char_index
=
0
;
size_t
char_index
=
0
;
if
(
png_check_fp_number
(
string
,
size
,
&
state
,
&
char_index
)
!=
0
&&
(
char_index
==
size
||
string
[
char_index
]
==
0
))
...
...
@@ -2860,7 +2900,7 @@ png_pow10(int power)
if
(
power
<
0
)
{
if
(
power
<
DBL_MIN_10_EXP
)
return
0
;
recip
=
1
,
power
=
-
power
;
recip
=
1
;
power
=
-
power
;
}
if
(
power
>
0
)
...
...
@@ -2885,8 +2925,16 @@ png_pow10(int power)
/* Function to format a floating point value in ASCII with a given
* precision.
*/
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic push
/* The problem arises below with exp_b10, which can never overflow because it
* comes, originally, from frexp and is therefore limited to a range which is
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
*/
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif
/* GCC_STRICT_OVERFLOW */
void
/* PRIVATE */
png_ascii_from_fp
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
png_ascii_from_fp
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
size_t
size
,
double
fp
,
unsigned
int
precision
)
{
/* We use standard functions from math.h, but not printf because
...
...
@@ -2938,7 +2986,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double
test
=
png_pow10
(
exp_b10
+
1
);
if
(
test
<=
DBL_MAX
)
++
exp_b10
,
base
=
test
;
{
++
exp_b10
;
base
=
test
;
}
else
break
;
...
...
@@ -2952,7 +3002,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
* test on DBL_MAX above.
*/
fp
/=
base
;
while
(
fp
>=
1
)
fp
/=
10
,
++
exp_b10
;
while
(
fp
>=
1
)
{
fp
/=
10
;
++
exp_b10
;
}
/* Because of the code above fp may, at this point, be
* less than .1, this is ok because the code below can
...
...
@@ -2969,7 +3022,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
if
(
exp_b10
<
0
&&
exp_b10
>
-
3
)
/* PLUS 3 TOTAL 4 */
{
czero
=
(
unsigned
int
)(
-
exp_b10
)
;
/* PLUS 2 digits: TOTAL 3 */
czero
=
0U
-
exp_b10
;
/* PLUS 2 digits: TOTAL 3 */
exp_b10
=
0
;
/* Dot added below before first output. */
}
else
...
...
@@ -3003,7 +3056,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Rounding up to 10, handle that here. */
if
(
czero
>
0
)
{
--
czero
,
d
=
1
;
--
czero
;
d
=
1
;
if
(
cdigits
==
0
)
--
clead
;
}
else
...
...
@@ -3017,7 +3070,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
else
if
(
ch
==
46
)
{
ch
=
*--
ascii
,
++
size
;
ch
=
*--
ascii
;
++
size
;
/* Advance exp_b10 to '1', so that the
* decimal point happens after the
* previous digit.
...
...
@@ -3044,7 +3097,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
int
ch
=
*--
ascii
;
if
(
ch
==
46
)
++
size
,
exp_b10
=
1
;
{
++
size
;
exp_b10
=
1
;
}
/* Else lost a leading zero, so 'exp_b10' is
* still ok at (-1)
...
...
@@ -3080,21 +3135,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
if
(
exp_b10
!=
(
-
1
))
{
if
(
exp_b10
==
0
)
*
ascii
++
=
46
,
--
size
;
if
(
exp_b10
==
0
)
{
*
ascii
++
=
46
;
--
size
;
}
/* PLUS 1: TOTAL 4 */
--
exp_b10
;
}
*
ascii
++
=
48
,
--
czero
;
*
ascii
++
=
48
;
--
czero
;
}
if
(
exp_b10
!=
(
-
1
))
{
if
(
exp_b10
==
0
)
*
ascii
++
=
46
,
--
size
;
/* counted above */
{
*
ascii
++
=
46
;
--
size
;
/* counted above */
}
--
exp_b10
;
}
*
ascii
++
=
(
char
)(
48
+
(
int
)
d
)
,
++
cdigits
;
*
ascii
++
=
(
char
)(
48
+
(
int
)
d
)
;
++
cdigits
;
}
}
while
(
cdigits
+
czero
<
precision
+
clead
&&
fp
>
DBL_MIN
);
...
...
@@ -3103,7 +3163,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At
* this point exp_b10==(-1) is effectively
if
flag - it got
* this point exp_b10==(-1) is effectively
a
flag - it got
* to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is
* *not* -1!)
...
...
@@ -3117,7 +3177,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
* zeros were *not* output, so this doesn't increase
* the output count.
*/
while
(
--
exp_b10
>=
0
)
*
ascii
++
=
48
;
while
(
exp_b10
--
>
0
)
*
ascii
++
=
48
;
*
ascii
=
0
;
...
...
@@ -3135,7 +3195,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
size
-=
cdigits
;
*
ascii
++
=
69
,
--
size
;
/* 'E': PLUS 1 TOTAL 2+precision */
*
ascii
++
=
69
;
--
size
;
/* 'E': PLUS 1 TOTAL 2+precision */
/* The following use of an unsigned temporary avoids ambiguities in
* the signed arithmetic on exp_b10 and permits GCC at least to do
...
...
@@ -3146,12 +3206,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
if
(
exp_b10
<
0
)
{
*
ascii
++
=
45
,
--
size
;
/* '-': PLUS 1 TOTAL 3+precision */
uexp_b10
=
(
unsigned
int
)(
-
exp_b10
)
;
*
ascii
++
=
45
;
--
size
;
/* '-': PLUS 1 TOTAL 3+precision */
uexp_b10
=
0U
-
exp_b10
;
}
else
uexp_b10
=
(
unsigned
int
)
exp_b10
;
uexp_b10
=
0U
+
exp_b10
;
cdigits
=
0
;
...
...
@@ -3194,6 +3254,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Here on buffer too small. */
png_error
(
png_ptr
,
"ASCII conversion buffer too small"
);
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif
/* GCC_STRICT_OVERFLOW */
# endif
/* FLOATING_POINT */
...
...
@@ -3202,7 +3265,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
void
/* PRIVATE */
png_ascii_from_fixed
(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
png_fixed_point
fp
)
size_t
size
,
png_fixed_point
fp
)
{
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
* trailing \0, 13 characters:
...
...
@@ -3213,7 +3276,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
/* Avoid overflow here on the minimum integer. */
if
(
fp
<
0
)
*
ascii
++
=
45
,
num
=
(
png_uint_32
)(
-
fp
);
{
*
ascii
++
=
45
;
num
=
(
png_uint_32
)(
-
fp
);
}
else
num
=
(
png_uint_32
)
fp
;
...
...
@@ -3251,7 +3316,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
* then ndigits digits to first:
*/
i
=
5
;
while
(
ndigits
<
i
)
*
ascii
++
=
48
,
--
i
;
while
(
ndigits
<
i
)
{
*
ascii
++
=
48
;
--
i
;
}
while
(
ndigits
>=
first
)
*
ascii
++
=
digits
[
--
ndigits
];
/* Don't output the trailing zeros! */
}
...
...
@@ -3302,6 +3370,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
* the nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow.
*/
#if GCC_STRICT_OVERFLOW
/* from above */
/* It is not obvious which comparison below gets optimized in such a way that
* signed overflow would change the result; looking through the code does not
* reveal any tests which have the form GCC complains about, so presumably the
* optimizer is moving an add or subtract into the 'if' somewhere.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif
/* GCC_STRICT_OVERFLOW */
int
png_muldiv
(
png_fixed_point_p
res
,
png_fixed_point
a
,
png_int_32
times
,
png_int_32
divisor
)
...
...
@@ -3416,6 +3493,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
return
0
;
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif
/* GCC_STRICT_OVERFLOW */
#endif
/* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
...
...
@@ -3709,7 +3789,7 @@ png_log16bit(png_uint_32 x)
* of getting this accuracy in practice.
*
* To deal with this the following exp() function works out the exponent of the
* frational part of the logarithm by using an accurate 32-bit value from the
* fra
c
tional part of the logarithm by using an accurate 32-bit value from the
* top four fractional bits then multiplying in the remaining bits.
*/
static
const
png_uint_32
...
...
@@ -4288,13 +4368,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
if
(
png_ptr
!=
NULL
&&
option
>=
0
&&
option
<
PNG_OPTION_NEXT
&&
(
option
&
1
)
==
0
)
{
png_uint_32
mask
=
3
<<
option
;
png_uint_32
setting
=
(
2
+
(
onoff
!=
0
))
<<
option
;
png_uint_32
mask
=
3
U
<<
option
;
png_uint_32
setting
=
(
2
U
+
(
onoff
!=
0
))
<<
option
;
png_uint_32
current
=
png_ptr
->
options
;
png_ptr
->
options
=
(
png_uint_32
)((
(
current
&
~
mask
)
|
setting
)
&
0xff
);
png_ptr
->
options
=
(
png_uint_32
)((
current
&
~
mask
)
|
setting
);
return
(
current
&
mask
)
>>
option
;
return
(
int
)(
current
&
mask
)
>>
option
;
}
return
PNG_OPTION_INVALID
;
...
...
@@ -4306,7 +4386,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
* specification (see the article at http
s
://en.wikipedia.org/wiki/SRGB)
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
* The inverse (linear to sRGB) table has accuracies as follows:
...
...
src/share/native/sun/awt/libpng/png.h
浏览文件 @
a4517b4b
此差异已折叠。
点击以展开。
src/share/native/sun/awt/libpng/pngconf.h
浏览文件 @
a4517b4b
...
...
@@ -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.
28, January 5, 2017
* libpng version 1.6.
35, July 15, 2018
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* Copyright (c) 1998-2002,2004,2006-2016
,2018
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,7 @@
*
* These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases
* (x86 DOS/Windows sytems) and, even then, this does not apply to
* (x86 DOS/Windows sy
s
tems) and, even then, this does not apply to
* Cygwin running on those systems.
*
* Note that the value must be defined in pnglibconf.h so that what
...
...
@@ -543,8 +543,10 @@
# error "libpng requires an unsigned 32-bit (or more) type"
#endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
* From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
* behavior of sizeof and ptrdiff_t are required.
* The legacy typedefs are provided here for backwards compatibility.
*/
typedef
size_t
png_size_t
;
typedef
ptrdiff_t
png_ptrdiff_t
;
...
...
@@ -565,13 +567,12 @@ typedef ptrdiff_t png_ptrdiff_t;
# endif
#endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
* them at all so that the compiler can complain when something turns out to be
* problematic.
/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
* than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are
* not necessary; in fact, it is recommended not to use them at all, so that
* the compiler can complain when something turns out to be problematic.
*
* Casts in the other direction (from png_alloc_size_t to
png_
size_t or
* Casts in the other direction (from png_alloc_size_t to size_t or
* png_uint_32) should be explicitly applied; however, we do not expect to
* encounter practical situations that require such conversions.
*
...
...
@@ -581,7 +582,7 @@ typedef ptrdiff_t png_ptrdiff_t;
#ifdef PNG_SMALL_SIZE_T
typedef
png_uint_32
png_alloc_size_t
;
#else
typedef
png_
size_t
png_alloc_size_t
;
typedef
size_t
png_alloc_size_t
;
#endif
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
...
...
@@ -617,8 +618,8 @@ typedef char * png_charp;
typedef
const
char
*
png_const_charp
;
typedef
png_fixed_point
*
png_fixed_point_p
;
typedef
const
png_fixed_point
*
png_const_fixed_point_p
;
typedef
png_size_t
*
png_size_tp
;
typedef
const
png_size_t
*
png_const_size_tp
;
typedef
size_t
*
png_size_tp
;
typedef
const
size_t
*
png_const_size_tp
;
#ifdef PNG_STDIO_SUPPORTED
typedef
FILE
*
png_FILE_p
;
...
...
src/share/native/sun/awt/libpng/pngerror.c
浏览文件 @
a4517b4b
...
...
@@ -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.
26 [October 20, 2016
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
31 [July 27, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
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.)
*
...
...
@@ -191,7 +191,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case
PNG_NUMBER_FORMAT_02u
:
/* Expects at least 2 digits. */
mincount
=
2
;
/* FALL
THROUGH */
/* FALLTHROUGH */
case
PNG_NUMBER_FORMAT_u
:
*--
end
=
digits
[
number
%
10
];
...
...
@@ -201,7 +201,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case
PNG_NUMBER_FORMAT_02x
:
/* This format expects at least two digits */
mincount
=
2
;
/* FALL
THROUGH */
/* FALLTHROUGH */
case
PNG_NUMBER_FORMAT_x
:
*--
end
=
digits
[
number
&
0xf
];
...
...
src/share/native/sun/awt/libpng/pngget.c
浏览文件 @
a4517b4b
...
...
@@ -28,9 +28,9 @@
* 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:
* Last changed in libpng 1.6.
26 [October 20, 2016
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
*
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -54,7 +54,7 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
return
(
0
);
}
png_
size_t
PNGAPI
size_t
PNGAPI
png_get_rowbytes
(
png_const_structrp
png_ptr
,
png_const_inforp
info_ptr
)
{
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
...
...
@@ -395,7 +395,7 @@ png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
static
png_fixed_point
png_fixed_inches_from_microns
(
png_const_structrp
png_ptr
,
png_int_32
microns
)
{
/* Convert from met
re
s * 1,000,000 to inches * 100,000, meters to
/* Convert from met
er
s * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
* Notice that this can overflow - a warning is output and 0 is
* returned.
...
...
@@ -769,8 +769,7 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
(
info_ptr
->
valid
&
PNG_INFO_iCCP
)
!=
0
&&
name
!=
NULL
&&
compression_type
!=
NULL
&&
profile
!=
NULL
&&
proflen
!=
NULL
)
name
!=
NULL
&&
profile
!=
NULL
&&
proflen
!=
NULL
)
{
*
name
=
info_ptr
->
iccp_name
;
*
profile
=
info_ptr
->
iccp_profile
;
...
...
@@ -778,11 +777,13 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
/* This is somewhat irrelevant since the profile data returned has
* actually been uncompressed.
*/
*
compression_type
=
PNG_COMPRESSION_TYPE_BASE
;
if
(
compression_type
!=
NULL
)
*
compression_type
=
PNG_COMPRESSION_TYPE_BASE
;
return
(
PNG_INFO_iCCP
);
}
return
(
0
);
}
#endif
...
...
@@ -801,6 +802,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
}
#endif
#ifdef PNG_eXIf_SUPPORTED
png_uint_32
PNGAPI
png_get_eXIf
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
png_bytep
*
exif
)
{
png_warning
(
png_ptr
,
"png_get_eXIf does not work; use png_get_eXIf_1"
);
PNG_UNUSED
(
info_ptr
)
PNG_UNUSED
(
exif
)
return
0
;
}
png_uint_32
PNGAPI
png_get_eXIf_1
(
png_const_structrp
png_ptr
,
png_const_inforp
info_ptr
,
png_uint_32
*
num_exif
,
png_bytep
*
exif
)
{
png_debug1
(
1
,
"in %s retrieval function"
,
"eXIf"
);
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
(
info_ptr
->
valid
&
PNG_INFO_eXIf
)
!=
0
&&
exif
!=
NULL
)
{
*
num_exif
=
info_ptr
->
num_exif
;
*
exif
=
info_ptr
->
exif
;
return
(
PNG_INFO_eXIf
);
}
return
(
0
);
}
#endif
#ifdef PNG_hIST_SUPPORTED
png_uint_32
PNGAPI
png_get_hIST
(
png_const_structrp
png_ptr
,
png_inforp
info_ptr
,
...
...
@@ -1163,7 +1193,7 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
}
#endif
png_
size_t
PNGAPI
size_t
PNGAPI
png_get_compression_buffer_size
(
png_const_structrp
png_ptr
)
{
if
(
png_ptr
==
NULL
)
...
...
src/share/native/sun/awt/libpng/pnginfo.h
浏览文件 @
a4517b4b
...
...
@@ -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.
1 [March 28, 2013
]
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2013
,2018
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.)
*
...
...
@@ -83,10 +83,10 @@
struct
png_info_def
{
/* The following are necessary for every PNG file */
png_uint_32
width
;
/* width of image in pixels (from IHDR) */
png_uint_32
height
;
/* height of image in pixels (from IHDR) */
png_uint_32
valid
;
/* valid chunk data (see PNG_INFO_ below) */
png_size_t
rowbytes
;
/* bytes needed to hold an untransformed row */
png_uint_32
width
;
/* width of image in pixels (from IHDR) */
png_uint_32
height
;
/* height of image in pixels (from IHDR) */
png_uint_32
valid
;
/* valid chunk data (see PNG_INFO_ below) */
size_t
rowbytes
;
/* bytes needed to hold an untransformed row */
png_colorp
palette
;
/* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16
num_palette
;
/* number of color entries in "palette" (PLTE) */
png_uint_16
num_trans
;
/* number of transparent palette color (tRNS) */
...
...
@@ -213,6 +213,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte
phys_unit_type
;
/* resolution type (see PNG_RESOLUTION_ below) */
#endif
#ifdef PNG_eXIf_SUPPORTED
int
num_exif
;
/* Added at libpng-1.6.31 */
png_bytep
exif
;
# ifdef PNG_READ_eXIf_SUPPORTED
png_bytep
eXIf_buf
;
/* Added at libpng-1.6.32 */
# endif
#endif
#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
...
...
@@ -267,7 +275,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height correspon
s
ing to one pixel
* values. The values are width and height correspon
d
ing to one pixel
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/
...
...
src/share/native/sun/awt/libpng/pnglibconf.h
浏览文件 @
a4517b4b
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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:
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
...
...
@@ -33,9 +38,9 @@
* file and, per its terms, should not be removed:
*/
/* libpng version 1.6.
28, January 5, 2017
*/
/* libpng version 1.6.
35, July 15, 2018
*/
/* Copyright (c) 1998-201
6
Glenn Randers-Pehrson */
/* Copyright (c) 1998-201
8
Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */
...
...
src/share/native/sun/awt/libpng/pngpread.c
浏览文件 @
a4517b4b
...
...
@@ -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.
24 [August 4, 2016
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -62,7 +62,7 @@ if (png_ptr->buffer_size < N) \
void
PNGAPI
png_process_data
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_size
)
png_bytep
buffer
,
size_t
buffer_size
)
{
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
...
...
@@ -75,7 +75,7 @@ png_process_data(png_structrp png_ptr, png_inforp info_ptr,
}
}
png_
size_t
PNGAPI
size_t
PNGAPI
png_process_data_pause
(
png_structrp
png_ptr
,
int
save
)
{
if
(
png_ptr
!=
NULL
)
...
...
@@ -88,7 +88,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
else
{
/* This includes any pending saved bytes: */
png_
size_t
remaining
=
png_ptr
->
buffer_size
;
size_t
remaining
=
png_ptr
->
buffer_size
;
png_ptr
->
buffer_size
=
0
;
/* So subtract the saved buffer size, unless all the data
...
...
@@ -161,8 +161,8 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
void
/* PRIVATE */
png_push_read_sig
(
png_structrp
png_ptr
,
png_inforp
info_ptr
)
{
png_size_t
num_checked
=
png_ptr
->
sig_bytes
,
/* SAFE, does not exceed 8 */
num_to_check
=
8
-
num_checked
;
size_t
num_checked
=
png_ptr
->
sig_bytes
;
/* SAFE, does not exceed 8 */
size_t
num_to_check
=
8
-
num_checked
;
if
(
png_ptr
->
buffer_size
<
num_to_check
)
{
...
...
@@ -217,6 +217,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_crc_read
(
png_ptr
,
chunk_tag
,
4
);
png_ptr
->
chunk_name
=
PNG_CHUNK_FROM_STRING
(
chunk_tag
);
png_check_chunk_name
(
png_ptr
,
png_ptr
->
chunk_name
);
png_check_chunk_length
(
png_ptr
,
png_ptr
->
push_length
);
png_ptr
->
mode
|=
PNG_HAVE_CHUNK_HEADER
;
}
...
...
@@ -445,7 +446,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
}
void
PNGCBAPI
png_push_fill_buffer
(
png_structp
png_ptr
,
png_bytep
buffer
,
png_
size_t
length
)
png_push_fill_buffer
(
png_structp
png_ptr
,
png_bytep
buffer
,
size_t
length
)
{
png_bytep
ptr
;
...
...
@@ -455,7 +456,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
ptr
=
buffer
;
if
(
png_ptr
->
save_buffer_size
!=
0
)
{
png_
size_t
save_size
;
size_t
save_size
;
if
(
length
<
png_ptr
->
save_buffer_size
)
save_size
=
length
;
...
...
@@ -472,7 +473,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
}
if
(
length
!=
0
&&
png_ptr
->
current_buffer_size
!=
0
)
{
png_
size_t
save_size
;
size_t
save_size
;
if
(
length
<
png_ptr
->
current_buffer_size
)
save_size
=
length
;
...
...
@@ -494,7 +495,7 @@ png_push_save_buffer(png_structrp png_ptr)
{
if
(
png_ptr
->
save_buffer_ptr
!=
png_ptr
->
save_buffer
)
{
png_
size_t
i
,
istop
;
size_t
i
,
istop
;
png_bytep
sp
;
png_bytep
dp
;
...
...
@@ -509,7 +510,7 @@ png_push_save_buffer(png_structrp png_ptr)
if
(
png_ptr
->
save_buffer_size
+
png_ptr
->
current_buffer_size
>
png_ptr
->
save_buffer_max
)
{
png_
size_t
new_max
;
size_t
new_max
;
png_bytep
old_buffer
;
if
(
png_ptr
->
save_buffer_size
>
PNG_SIZE_MAX
-
...
...
@@ -521,7 +522,7 @@ png_push_save_buffer(png_structrp png_ptr)
new_max
=
png_ptr
->
save_buffer_size
+
png_ptr
->
current_buffer_size
+
256
;
old_buffer
=
png_ptr
->
save_buffer
;
png_ptr
->
save_buffer
=
(
png_bytep
)
png_malloc_warn
(
png_ptr
,
(
png_
size_t
)
new_max
);
(
size_t
)
new_max
);
if
(
png_ptr
->
save_buffer
==
NULL
)
{
...
...
@@ -549,7 +550,7 @@ png_push_save_buffer(png_structrp png_ptr)
void
/* PRIVATE */
png_push_restore_buffer
(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
)
size_t
buffer_length
)
{
png_ptr
->
current_buffer
=
buffer
;
png_ptr
->
current_buffer_size
=
buffer_length
;
...
...
@@ -589,7 +590,7 @@ png_push_read_IDAT(png_structrp png_ptr)
if
(
png_ptr
->
idat_size
!=
0
&&
png_ptr
->
save_buffer_size
!=
0
)
{
png_
size_t
save_size
=
png_ptr
->
save_buffer_size
;
size_t
save_size
=
png_ptr
->
save_buffer_size
;
png_uint_32
idat_size
=
png_ptr
->
idat_size
;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
...
...
@@ -599,7 +600,7 @@ png_push_read_IDAT(png_structrp png_ptr)
* will break on either 16-bit or 64-bit platforms.
*/
if
(
idat_size
<
save_size
)
save_size
=
(
png_
size_t
)
idat_size
;
save_size
=
(
size_t
)
idat_size
;
else
idat_size
=
(
png_uint_32
)
save_size
;
...
...
@@ -616,7 +617,7 @@ png_push_read_IDAT(png_structrp png_ptr)
if
(
png_ptr
->
idat_size
!=
0
&&
png_ptr
->
current_buffer_size
!=
0
)
{
png_
size_t
save_size
=
png_ptr
->
current_buffer_size
;
size_t
save_size
=
png_ptr
->
current_buffer_size
;
png_uint_32
idat_size
=
png_ptr
->
idat_size
;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
...
...
@@ -625,7 +626,7 @@ png_push_read_IDAT(png_structrp png_ptr)
* larger - this cannot overflow.
*/
if
(
idat_size
<
save_size
)
save_size
=
(
png_
size_t
)
idat_size
;
save_size
=
(
size_t
)
idat_size
;
else
idat_size
=
(
png_uint_32
)
save_size
;
...
...
@@ -652,7 +653,7 @@ png_push_read_IDAT(png_structrp png_ptr)
void
/* PRIVATE */
png_process_IDAT_data
(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
)
size_t
buffer_length
)
{
/* The caller checks for a non-zero buffer length. */
if
(
!
(
buffer_length
>
0
)
||
buffer
==
NULL
)
...
...
src/share/native/sun/awt/libpng/pngpriv.h
浏览文件 @
a4517b4b
...
...
@@ -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.
26 [October 20, 2016
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -63,7 +63,9 @@
* Windows/Visual Studio) there is no effect; the OS specific tests below are
* still required (as of 2011-05-02.)
*/
#define _POSIX_SOURCE 1
/* Just the POSIX 1003.1 and C89 APIs */
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE 1
/* Just the POSIX 1003.1 and C89 APIs */
#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */
...
...
@@ -218,6 +220,56 @@
# endif
#endif
#ifndef PNG_POWERPC_VSX_OPT
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
# define PNG_POWERPC_VSX_OPT 2
# else
# define PNG_POWERPC_VSX_OPT 0
# endif
#endif
#ifndef PNG_INTEL_SSE_OPT
# ifdef PNG_INTEL_SSE
/* Only check for SSE if the build configuration has been modified to
* enable SSE optimizations. This means that these optimizations will
* be off by default. See contrib/intel for more details.
*/
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
# define PNG_INTEL_SSE_OPT 1
# else
# define PNG_INTEL_SSE_OPT 0
# endif
# else
# define PNG_INTEL_SSE_OPT 0
# endif
#endif
#if PNG_INTEL_SSE_OPT > 0
# ifndef PNG_INTEL_SSE_IMPLEMENTATION
# if defined(__SSE4_1__) || defined(__AVX__)
/* We are not actually using AVX, but checking for AVX is the best
way we can detect SSE4.1 and SSSE3 on MSVC.
*/
# define PNG_INTEL_SSE_IMPLEMENTATION 3
# elif defined(__SSSE3__)
# define PNG_INTEL_SSE_IMPLEMENTATION 2
# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
# define PNG_INTEL_SSE_IMPLEMENTATION 1
# else
# define PNG_INTEL_SSE_IMPLEMENTATION 0
# endif
# endif
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
# endif
#else
# define PNG_INTEL_SSE_IMPLEMENTATION 0
#endif
#if PNG_MIPS_MSA_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
...
...
@@ -238,6 +290,13 @@
# endif
#endif
/* PNG_MIPS_MSA_OPT > 0 */
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
#if PNG_POWERPC_VSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
#endif
#endif
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If
...
...
@@ -431,6 +490,21 @@
# define png_fixed_error(s1,s2) png_err(s1)
#endif
/* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic
* deals with this:
*/
#ifdef PNG_FIXED_POINT_SUPPORTED
# define PNGFAPI PNGAPI
#else
# define PNGFAPI
/* PRIVATE */
#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
/* C allows up-casts from (void*) to any pointer and (const void*) to any
* pointer to a const object. C++ regards this as a type error and requires an
* explicit, static, cast and provides the static_cast<> rune to ensure that
...
...
@@ -445,25 +519,20 @@
static_cast<type>(static_cast<const void*>(value))
#else
# define png_voidcast(type, value) (value)
# define png_constcast(type, value) ((type)(value))
# ifdef _WIN64
# ifdef __GNUC__
typedef
unsigned
long
long
png_ptruint
;
# else
typedef
unsigned
__int64
png_ptruint
;
# endif
# else
typedef
unsigned
long
png_ptruint
;
# endif
# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
# define png_aligncast(type, value) ((void*)(value))
# define png_aligncastconst(type, value) ((const void*)(value))
#endif
/* __cplusplus */
/* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic
* deals with this:
*/
#ifdef PNG_FIXED_POINT_SUPPORTED
# define PNGFAPI PNGAPI
#else
# define PNGFAPI
/* PRIVATE */
#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
...
...
@@ -695,8 +764,8 @@
/* Added to libpng-1.2.6 JB */
#define PNG_ROWBYTES(pixel_bits, width) \
((pixel_bits) >= 8 ? \
((
png_size_t)(width) * (((png_
size_t)(pixel_bits)) >> 3)) : \
(( ((
png_size_t)(width) * ((png_
size_t)(pixel_bits))) + 7) >> 3) )
((
size_t)(width) * (((
size_t)(pixel_bits)) >> 3)) : \
(( ((
size_t)(width) * ((
size_t)(pixel_bits))) + 7) >> 3) )
/* This returns the number of trailing bits in the last byte of a row, 0 if the
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
...
...
@@ -809,6 +878,7 @@
#define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77)
#define png_eXIf PNG_U32(101, 88, 73, 102)
/* registered July 2017 */
#define png_fRAc PNG_U32(102, 82, 65, 99)
/* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65)
#define png_gIFg PNG_U32(103, 73, 70, 103)
...
...
@@ -883,7 +953,7 @@
* PNG files the -I directives must match.
*
* The most likely explanation is that you passed a -I in CFLAGS. This will
* not work; all the preprocessor direct
ori
es and in particular all the -I
* not work; all the preprocessor direct
iv
es and in particular all the -I
* directives must be in CPPFLAGS.
*/
#endif
...
...
@@ -1012,15 +1082,15 @@ PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
*/
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_default_read_data
,(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
data
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_push_fill_buffer
,(
png_structp
png_ptr
,
png_bytep
buffer
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
length
),
PNG_EMPTY
);
#endif
PNG_INTERNAL_FUNCTION
(
void
PNGCBAPI
,
png_default_write_data
,(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_bytep
data
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
...
...
@@ -1034,7 +1104,7 @@ PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
/* Write the "data" buffer to whatever output you are using */
PNG_INTERNAL_FUNCTION
(
void
,
png_write_data
,(
png_structrp
png_ptr
,
png_const_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
png_const_bytep
data
,
size_t
length
),
PNG_EMPTY
);
/* Read and check the PNG file signature */
PNG_INTERNAL_FUNCTION
(
void
,
png_read_sig
,(
png_structrp
png_ptr
,
...
...
@@ -1046,7 +1116,7 @@ PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
/* Read data from whatever input you are using into the "data" buffer */
PNG_INTERNAL_FUNCTION
(
void
,
png_read_data
,(
png_structrp
png_ptr
,
png_bytep
data
,
png_
size_t
length
),
PNG_EMPTY
);
size_t
length
),
PNG_EMPTY
);
/* Read bytes into buf, and update png_ptr->crc */
PNG_INTERNAL_FUNCTION
(
void
,
png_crc_read
,(
png_structrp
png_ptr
,
png_bytep
buf
,
...
...
@@ -1064,7 +1134,7 @@ PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
* since this is the maximum buffer size we can specify.
*/
PNG_INTERNAL_FUNCTION
(
void
,
png_calculate_crc
,(
png_structrp
png_ptr
,
png_const_bytep
ptr
,
png_
size_t
length
),
PNG_EMPTY
);
png_const_bytep
ptr
,
size_t
length
),
PNG_EMPTY
);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_flush
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
...
...
@@ -1109,6 +1179,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
int
intent
),
PNG_EMPTY
);
#endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_write_eXIf
,(
png_structrp
png_ptr
,
png_bytep
exif
,
int
num_exif
),
PNG_EMPTY
);
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_write_iCCP
,(
png_structrp
png_ptr
,
png_const_charp
name
,
png_const_bytep
profile
),
PNG_EMPTY
);
...
...
@@ -1142,7 +1217,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
/* Chunks that have keywords */
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_write_tEXt
,(
png_structrp
png_ptr
,
png_const_charp
key
,
png_const_charp
text
,
png_
size_t
text_len
),
PNG_EMPTY
);
png_const_charp
key
,
png_const_charp
text
,
size_t
text_len
),
PNG_EMPTY
);
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
...
...
@@ -1284,6 +1359,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_POWERPC_VSX_OPT > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_up_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub3_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub4_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg3_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg4_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth3_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth4_vsx
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
#if PNG_INTEL_SSE_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub3_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_sub4_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg3_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_avg4_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth3_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_read_filter_row_paeth4_sse2
,(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
),
PNG_EMPTY
);
#endif
/* Choose the best filter to use and filter the row data */
PNG_INTERNAL_FUNCTION
(
void
,
png_write_find_filter
,(
png_structrp
png_ptr
,
png_row_infop
row_info
),
PNG_EMPTY
);
...
...
@@ -1376,6 +1483,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
png_inforp
info_ptr
,
png_uint_32
length
),
PNG_EMPTY
);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_handle_eXIf
,(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
),
PNG_EMPTY
);
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_handle_gAMA
,(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
),
PNG_EMPTY
);
...
...
@@ -1451,8 +1563,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
png_inforp
info_ptr
,
png_uint_32
length
),
PNG_EMPTY
);
#endif
PNG_INTERNAL_FUNCTION
(
void
,
png_check_chunk_name
,(
png_structrp
png_ptr
,
png_uint_32
chunk_name
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_check_chunk_name
,(
png_const_structrp
png_ptr
,
const
png_uint_32
chunk_name
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_check_chunk_length
,(
png_const_structrp
png_ptr
,
const
png_uint_32
chunk_length
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_handle_unknown
,(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
,
int
keep
),
PNG_EMPTY
);
...
...
@@ -1495,10 +1610,10 @@ PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_save_buffer
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_restore_buffer
,(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
buffer_length
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_read_IDAT
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_process_IDAT_data
,(
png_structrp
png_ptr
,
png_bytep
buffer
,
png_
size_t
buffer_length
),
PNG_EMPTY
);
png_bytep
buffer
,
size_t
buffer_length
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_process_row
,(
png_structrp
png_ptr
),
PNG_EMPTY
);
PNG_INTERNAL_FUNCTION
(
void
,
png_push_handle_unknown
,(
png_structrp
png_ptr
,
...
...
@@ -1768,13 +1883,13 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_ascii_from_fp
,(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
double
fp
,
unsigned
int
precision
),
png_charp
ascii
,
size_t
size
,
double
fp
,
unsigned
int
precision
),
PNG_EMPTY
);
#endif
/* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_INTERNAL_FUNCTION
(
void
,
png_ascii_from_fixed
,(
png_const_structrp
png_ptr
,
png_charp
ascii
,
png_
size_t
size
,
png_fixed_point
fp
),
PNG_EMPTY
);
png_charp
ascii
,
size_t
size
,
png_fixed_point
fp
),
PNG_EMPTY
);
#endif
/* FIXED_POINT */
#endif
/* sCAL */
...
...
@@ -1867,7 +1982,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
* the problem character.) This has not been tested within libpng.
*/
PNG_INTERNAL_FUNCTION
(
int
,
png_check_fp_number
,(
png_const_charp
string
,
png_
size_t
size
,
int
*
statep
,
png_size_tp
whereami
),
PNG_EMPTY
);
size_t
size
,
int
*
statep
,
png_size_tp
whereami
),
PNG_EMPTY
);
/* This is the same but it checks a complete string and returns true
* only if it just contains a floating point number. As of 1.5.4 this
...
...
@@ -1876,7 +1991,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
* for negative or zero values using the sticky flag.
*/
PNG_INTERNAL_FUNCTION
(
int
,
png_check_fp_string
,(
png_const_charp
string
,
png_
size_t
size
),
PNG_EMPTY
);
size_t
size
),
PNG_EMPTY
);
#endif
/* pCAL || sCAL */
#if defined(PNG_GAMMA_SUPPORTED) ||\
...
...
@@ -1951,7 +2066,7 @@ typedef struct png_control
png_voidp
error_buf
;
/* Always a jmp_buf at present. */
png_const_bytep
memory
;
/* Memory buffer. */
png_size_t
size
;
/* Size of the memory buffer. */
size_t
size
;
/* Size of the memory buffer. */
unsigned
int
for_write
:
1
;
/* Otherwise it is a read structure */
unsigned
int
owned_file
:
1
;
/* We own the file in io_ptr */
...
...
@@ -2019,6 +2134,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_msa
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
#endif
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION
(
void
,
png_init_filter_functions_sse2
,
(
png_structp
png_ptr
,
unsigned
int
bpp
),
PNG_EMPTY
);
# endif
#endif
PNG_INTERNAL_FUNCTION
(
png_uint_32
,
png_check_keyword
,
(
png_structrp
png_ptr
,
...
...
src/share/native/sun/awt/libpng/pngread.c
浏览文件 @
a4517b4b
...
...
@@ -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.
26 [October 20, 2016
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -203,6 +203,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cHRM
(
png_ptr
,
info_ptr
,
length
);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else
if
(
chunk_name
==
png_eXIf
)
png_handle_eXIf
(
png_ptr
,
info_ptr
,
length
);
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
else
if
(
chunk_name
==
png_gAMA
)
png_handle_gAMA
(
png_ptr
,
info_ptr
,
length
);
...
...
@@ -562,6 +567,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
png_error
(
png_ptr
,
"Invalid attempt to read row data"
);
/* Fill the row with IDAT data: */
png_ptr
->
row_buf
[
0
]
=
255
;
/* to force error if no data was found */
png_read_IDAT_data
(
png_ptr
,
png_ptr
->
row_buf
,
row_info
.
rowbytes
+
1
);
if
(
png_ptr
->
row_buf
[
0
]
>
PNG_FILTER_VALUE_NONE
)
...
...
@@ -870,6 +876,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cHRM
(
png_ptr
,
info_ptr
,
length
);
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else
if
(
chunk_name
==
png_eXIf
)
png_handle_eXIf
(
png_ptr
,
info_ptr
,
length
);
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
else
if
(
chunk_name
==
png_gAMA
)
png_handle_gAMA
(
png_ptr
,
info_ptr
,
length
);
...
...
@@ -1549,7 +1560,7 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
#endif
/* STDIO */
static
void
PNGCBAPI
png_image_memory_read
(
png_structp
png_ptr
,
png_bytep
out
,
png_
size_t
need
)
png_image_memory_read
(
png_structp
png_ptr
,
png_bytep
out
,
size_t
need
)
{
if
(
png_ptr
!=
NULL
)
{
...
...
@@ -1560,7 +1571,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
if
(
cp
!=
NULL
)
{
png_const_bytep
memory
=
cp
->
memory
;
png_
size_t
size
=
cp
->
size
;
size_t
size
=
cp
->
size
;
if
(
memory
!=
NULL
&&
size
>=
need
)
{
...
...
@@ -1579,7 +1590,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
}
int
PNGAPI
png_image_begin_read_from_memory
(
png_imagep
image
,
png_const_voidp
memory
,
png_
size_t
size
)
png_const_voidp
memory
,
size_t
size
)
{
if
(
image
!=
NULL
&&
image
->
version
==
PNG_IMAGE_VERSION
)
{
...
...
@@ -1911,7 +1922,7 @@ png_create_colormap_entry(png_image_read_control *display,
{
case
4
:
entry
[
afirst
?
0
:
3
]
=
(
png_uint_16
)
alpha
;
/* FALL
THROUGH */
/* FALLTHROUGH */
case
3
:
if
(
alpha
<
65535
)
...
...
@@ -1933,7 +1944,7 @@ png_create_colormap_entry(png_image_read_control *display,
case
2
:
entry
[
1
^
afirst
]
=
(
png_uint_16
)
alpha
;
/* FALL
THROUGH */
/* FALLTHROUGH */
case
1
:
if
(
alpha
<
65535
)
...
...
@@ -1962,6 +1973,7 @@ png_create_colormap_entry(png_image_read_control *display,
{
case
4
:
entry
[
afirst
?
0
:
3
]
=
(
png_byte
)
alpha
;
/* FALLTHROUGH */
case
3
:
entry
[
afirst
+
(
2
^
bgr
)]
=
(
png_byte
)
blue
;
entry
[
afirst
+
1
]
=
(
png_byte
)
green
;
...
...
@@ -1970,6 +1982,7 @@ png_create_colormap_entry(png_image_read_control *display,
case
2
:
entry
[
1
^
afirst
]
=
(
png_byte
)
alpha
;
/* FALLTHROUGH */
case
1
:
entry
[
afirst
]
=
(
png_byte
)
green
;
break
;
...
...
@@ -2889,7 +2902,7 @@ png_image_read_colormap(png_voidp argument)
case
P_sRGB
:
/* Change to 8-bit sRGB */
png_set_alpha_mode_fixed
(
png_ptr
,
PNG_ALPHA_PNG
,
PNG_GAMMA_sRGB
);
/* FALL
THROUGH */
/* FALLTHROUGH */
case
P_FILE
:
if
(
png_ptr
->
bit_depth
>
8
)
...
...
@@ -3207,8 +3220,7 @@ png_image_read_colormapped(png_voidp argument)
image
->
colormap_entries
==
244
/* 216 + 1 + 27 */
)
break
;
/* goto bad_output; */
/* FALL THROUGH */
goto
bad_output
;
default:
bad_output:
...
...
@@ -3776,6 +3788,12 @@ png_image_read_direct(png_voidp argument)
output_gamma
=
PNG_DEFAULT_sRGB
;
}
if
((
change
&
PNG_FORMAT_FLAG_ASSOCIATED_ALPHA
)
!=
0
)
{
mode
=
PNG_ALPHA_OPTIMIZED
;
change
&=
~
PNG_FORMAT_FLAG_ASSOCIATED_ALPHA
;
}
/* If 'do_local_background' is set check for the presence of gamma
* correction; this is part of the work-round for the libpng bug
* described above.
...
...
@@ -4001,6 +4019,10 @@ png_image_read_direct(png_voidp argument)
else
if
(
do_local_compose
!=
0
)
/* internal error */
png_error
(
png_ptr
,
"png_image_read: alpha channel lost"
);
if
((
format
&
PNG_FORMAT_FLAG_ASSOCIATED_ALPHA
)
!=
0
)
{
info_format
|=
PNG_FORMAT_FLAG_ASSOCIATED_ALPHA
;
}
if
(
info_ptr
->
bit_depth
==
16
)
info_format
|=
PNG_FORMAT_FLAG_LINEAR
;
...
...
@@ -4156,7 +4178,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
*
* NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
* will be changed to use png_alloc_size_t; bigger images can be
* accomodated on 64-bit systems.
* accom
m
odated on 64-bit systems.
*/
if
(
image
->
height
<=
0xffffffffU
/
PNG_IMAGE_PIXEL_COMPONENT_SIZE
(
image
->
format
)
/
check
)
...
...
src/share/native/sun/awt/libpng/pngrio.c
浏览文件 @
a4517b4b
...
...
@@ -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.
24 [August 4, 2016
]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-2016
,2018
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.)
*
...
...
@@ -57,7 +57,7 @@
* to read more than 64K on a 16-bit machine.
*/
void
/* PRIVATE */
png_read_data
(
png_structrp
png_ptr
,
png_bytep
data
,
png_
size_t
length
)
png_read_data
(
png_structrp
png_ptr
,
png_bytep
data
,
size_t
length
)
{
png_debug1
(
4
,
"reading %d bytes"
,
(
int
)
length
);
...
...
@@ -75,14 +75,14 @@ png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
* than changing the library.
*/
void
PNGCBAPI
png_default_read_data
(
png_structp
png_ptr
,
png_bytep
data
,
png_
size_t
length
)
png_default_read_data
(
png_structp
png_ptr
,
png_bytep
data
,
size_t
length
)
{
png_
size_t
check
;
size_t
check
;
if
(
png_ptr
==
NULL
)
return
;
/* fread() returns 0 on error, so it is OK to store this in a
png_
size_t
/* fread() returns 0 on error, so it is OK to store this in a size_t
* instead of an int, which is what fread() actually returns.
*/
check
=
fread
(
data
,
1
,
length
,
png_voidcast
(
png_FILE_p
,
png_ptr
->
io_ptr
));
...
...
src/share/native/sun/awt/libpng/pngrtran.c
浏览文件 @
a4517b4b
此差异已折叠。
点击以展开。
src/share/native/sun/awt/libpng/pngrutil.c
浏览文件 @
a4517b4b
...
...
@@ -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.
27 [January 5, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
6
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -130,7 +130,7 @@ png_get_int_32)(png_const_bytep buf)
png_uint_16
(
PNGAPI
png_get_uint_16
)(
png_const_bytep
buf
)
{
/* ANSI-C requires an int value to accomodate at least 16 bits so this
/* ANSI-C requires an int value to accom
m
odate at least 16 bits so this
* works and allows the compiler not to worry about possible narrowing
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
* than 16 bits either.)
...
...
@@ -148,7 +148,7 @@ png_get_uint_16)(png_const_bytep buf)
void
/* PRIVATE */
png_read_sig
(
png_structrp
png_ptr
,
png_inforp
info_ptr
)
{
png_
size_t
num_checked
,
num_to_check
;
size_t
num_checked
,
num_to_check
;
/* Exit if the user application does not expect a signature. */
if
(
png_ptr
->
sig_bytes
>=
8
)
...
...
@@ -209,6 +209,9 @@ png_read_chunk_header(png_structrp png_ptr)
/* Check to see if chunk name is valid. */
png_check_chunk_name
(
png_ptr
,
png_ptr
->
chunk_name
);
/* Check for too-large chunk length */
png_check_chunk_length
(
png_ptr
,
length
);
#ifdef PNG_IO_STATE_SUPPORTED
png_ptr
->
io_state
=
PNG_IO_READING
|
PNG_IO_CHUNK_DATA
;
#endif
...
...
@@ -339,6 +342,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
if
(
buffer
!=
NULL
)
{
memset
(
buffer
,
0
,
new_size
);
/* just in case */
png_ptr
->
read_buffer
=
buffer
;
png_ptr
->
read_buffer_size
=
new_size
;
}
...
...
@@ -446,7 +450,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr
->
flags
|=
PNG_FLAG_ZSTREAM_INITIALIZED
;
}
#if ZLIB_VERNUM >= 0x12
81
&& \
#if ZLIB_VERNUM >= 0x12
90
&& \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
if
(((
png_ptr
->
options
>>
PNG_IGNORE_ADLER32
)
&
3
)
==
PNG_OPTION_ON
)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
...
...
@@ -698,6 +702,8 @@ png_decompress_chunk(png_structrp png_ptr,
if
(
text
!=
NULL
)
{
memset
(
text
,
0
,
buffer_size
);
ret
=
png_inflate
(
png_ptr
,
png_ptr
->
chunk_name
,
1
/*finish*/
,
png_ptr
->
read_buffer
+
prefix_size
,
&
lzsize
,
text
+
prefix_size
,
newlength
);
...
...
@@ -761,9 +767,7 @@ png_decompress_chunk(png_structrp png_ptr,
{
/* inflateReset failed, store the error message */
png_zstream_error
(
png_ptr
,
ret
);
if
(
ret
==
Z_STREAM_END
)
ret
=
PNG_UNEXPECTED_ZLIB_RETURN
;
ret
=
PNG_UNEXPECTED_ZLIB_RETURN
;
}
}
...
...
@@ -1405,11 +1409,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* chunk is just ignored, so does not invalidate the color space. An
* alternative is to set the 'invalid' flags at the start of this routine
* and only clear them in they were not set before and all the tests pass.
* The minimum 'deflate' stream is assumed to be just the 2 byte header and
* 4 byte checksum. The keyword must be at least one character and there is
* a terminator (0) byte and the compression method.
*/
if
(
length
<
9
)
/* The keyword must be at least one character and there is a
* terminator (0) byte and the compression method byte, and the
* 'zlib' datastream is at least 11 bytes.
*/
if
(
length
<
14
)
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"too short"
);
...
...
@@ -1441,6 +1447,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
png_crc_read
(
png_ptr
,
(
png_bytep
)
keyword
,
read_length
);
length
-=
read_length
;
/* The minimum 'zlib' stream is assumed to be just the 2 byte header,
* 5 bytes minimum 'deflate' stream, and the 4 byte checksum.
*/
if
(
length
<
11
)
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"too short"
);
return
;
}
keyword_length
=
0
;
while
(
keyword_length
<
80
&&
keyword_length
<
read_length
&&
keyword
[
keyword_length
]
!=
0
)
...
...
@@ -1459,7 +1475,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if
(
png_inflate_claim
(
png_ptr
,
png_iCCP
)
==
Z_OK
)
{
Byte
profile_header
[
132
];
Byte
profile_header
[
132
]
=
{
0
}
;
Byte
local_buffer
[
PNG_INFLATE_BUF_SIZE
];
png_alloc_size_t
size
=
(
sizeof
profile_header
);
...
...
@@ -1489,7 +1505,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
/* Now read the tag table; a variable size buffer is
* needed at this point, allocate one for the whole
* profile. The header check has already validated
* that none of th
ese
stuff will overflow.
* that none of th
is
stuff will overflow.
*/
const
png_uint_32
tag_count
=
png_get_uint_32
(
profile_header
+
128
);
...
...
@@ -1596,19 +1612,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
return
;
}
}
else
if
(
size
>
0
)
errmsg
=
"truncated"
;
#ifndef __COVERITY__
else
if
(
errmsg
==
NULL
)
errmsg
=
png_ptr
->
zstream
.
msg
;
#endif
}
/* else png_icc_check_tag_table output an error */
}
else
/* profile truncated */
errmsg
=
png_ptr
->
zstream
.
msg
;
}
...
...
@@ -1668,7 +1676,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
int
entry_size
,
i
;
png_uint_32
skip
=
0
;
png_uint_32
dl
;
png_
size_t
max_dl
;
size_t
max_dl
;
png_debug
(
1
,
"in png_handle_sPLT"
);
...
...
@@ -2017,6 +2025,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
if
((
png_ptr
->
color_type
&
PNG_COLOR_MASK_COLOR
)
==
0
)
/* GRAY */
{
if
(
png_ptr
->
bit_depth
<=
8
)
{
if
(
buf
[
0
]
!=
0
||
buf
[
1
]
>=
(
unsigned
int
)(
1
<<
png_ptr
->
bit_depth
))
{
png_chunk_benign_error
(
png_ptr
,
"invalid gray level"
);
return
;
}
}
background
.
index
=
0
;
background
.
red
=
background
.
green
=
...
...
@@ -2026,6 +2043,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
{
if
(
png_ptr
->
bit_depth
<=
8
)
{
if
(
buf
[
0
]
!=
0
||
buf
[
2
]
!=
0
||
buf
[
4
]
!=
0
)
{
png_chunk_benign_error
(
png_ptr
,
"invalid color"
);
return
;
}
}
background
.
index
=
0
;
background
.
red
=
png_get_uint_16
(
buf
);
background
.
green
=
png_get_uint_16
(
buf
+
2
);
...
...
@@ -2037,6 +2063,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
void
/* PRIVATE */
png_handle_eXIf
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
)
{
unsigned
int
i
;
png_debug
(
1
,
"in png_handle_eXIf"
);
if
((
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
==
0
)
png_chunk_error
(
png_ptr
,
"missing IHDR"
);
if
(
length
<
2
)
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"too short"
);
return
;
}
else
if
(
info_ptr
==
NULL
||
(
info_ptr
->
valid
&
PNG_INFO_eXIf
)
!=
0
)
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"duplicate"
);
return
;
}
info_ptr
->
free_me
|=
PNG_FREE_EXIF
;
info_ptr
->
eXIf_buf
=
png_voidcast
(
png_bytep
,
png_malloc_warn
(
png_ptr
,
length
));
if
(
info_ptr
->
eXIf_buf
==
NULL
)
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"out of memory"
);
return
;
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
png_byte
buf
[
1
];
png_crc_read
(
png_ptr
,
buf
,
1
);
info_ptr
->
eXIf_buf
[
i
]
=
buf
[
0
];
if
(
i
==
1
&&
buf
[
0
]
!=
'M'
&&
buf
[
0
]
!=
'I'
&&
info_ptr
->
eXIf_buf
[
0
]
!=
buf
[
0
])
{
png_crc_finish
(
png_ptr
,
length
);
png_chunk_benign_error
(
png_ptr
,
"incorrect byte-order specifier"
);
png_free
(
png_ptr
,
info_ptr
->
eXIf_buf
);
info_ptr
->
eXIf_buf
=
NULL
;
return
;
}
}
if
(
png_crc_finish
(
png_ptr
,
0
)
!=
0
)
return
;
png_set_eXIf_1
(
png_ptr
,
info_ptr
,
length
,
info_ptr
->
eXIf_buf
);
png_free
(
png_ptr
,
info_ptr
->
eXIf_buf
);
info_ptr
->
eXIf_buf
=
NULL
;
}
#endif
#ifdef PNG_READ_hIST_SUPPORTED
void
/* PRIVATE */
png_handle_hIST
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
)
...
...
@@ -2316,7 +2405,7 @@ void /* PRIVATE */
png_handle_sCAL
(
png_structrp
png_ptr
,
png_inforp
info_ptr
,
png_uint_32
length
)
{
png_bytep
buffer
;
png_
size_t
i
;
size_t
i
;
int
state
;
png_debug
(
1
,
"in png_handle_sCAL"
);
...
...
@@ -2386,7 +2475,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
{
png_
size_t
heighti
=
i
;
size_t
heighti
=
i
;
state
=
0
;
if
(
png_check_fp_number
((
png_const_charp
)
buffer
,
length
,
...
...
@@ -2565,6 +2654,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if
((
png_ptr
->
mode
&
PNG_HAVE_IDAT
)
!=
0
)
png_ptr
->
mode
|=
PNG_AFTER_IDAT
;
/* Note, "length" is sufficient here; we won't be adding
* a null terminator later.
*/
buffer
=
png_read_buffer
(
png_ptr
,
length
,
2
/*silent*/
);
if
(
buffer
==
NULL
)
...
...
@@ -2611,23 +2703,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_text
text
;
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk except
* for the extra compression type byte and the fact that it isn't
* necessarily '\0' terminated.
*/
buffer
=
png_ptr
->
read_buffer
;
buffer
[
uncompressed_length
+
(
keyword_length
+
2
)]
=
0
;
text
.
compression
=
PNG_TEXT_COMPRESSION_zTXt
;
text
.
key
=
(
png_charp
)
buffer
;
text
.
text
=
(
png_charp
)(
buffer
+
keyword_length
+
2
);
text
.
text_length
=
uncompressed_length
;
text
.
itxt_length
=
0
;
text
.
lang
=
NULL
;
text
.
lang_key
=
NULL
;
if
(
png_set_text_2
(
png_ptr
,
info_ptr
,
&
text
,
1
)
!=
0
)
errmsg
=
"insufficient memory"
;
if
(
png_ptr
->
read_buffer
==
NULL
)
errmsg
=
"Read failure in png_handle_zTXt"
;
else
{
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk
* except for the extra compression type byte and the fact that
* it isn't necessarily '\0' terminated.
*/
buffer
=
png_ptr
->
read_buffer
;
buffer
[
uncompressed_length
+
(
keyword_length
+
2
)]
=
0
;
text
.
compression
=
PNG_TEXT_COMPRESSION_zTXt
;
text
.
key
=
(
png_charp
)
buffer
;
text
.
text
=
(
png_charp
)(
buffer
+
keyword_length
+
2
);
text
.
text_length
=
uncompressed_length
;
text
.
itxt_length
=
0
;
text
.
lang
=
NULL
;
text
.
lang_key
=
NULL
;
if
(
png_set_text_2
(
png_ptr
,
info_ptr
,
&
text
,
1
)
!=
0
)
errmsg
=
"insufficient memory"
;
}
}
else
...
...
@@ -2816,7 +2913,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
{
PNG_CSTRING_FROM_CHUNK
(
png_ptr
->
unknown_chunk
.
name
,
png_ptr
->
chunk_name
);
/* The following is safe because of the PNG_SIZE_MAX init above */
png_ptr
->
unknown_chunk
.
size
=
(
png_
size_t
)
length
/*SAFE*/
;
png_ptr
->
unknown_chunk
.
size
=
(
size_t
)
length
/*SAFE*/
;
/* 'mode' is a flag array, only the bottom four bits matter here */
png_ptr
->
unknown_chunk
.
location
=
(
png_byte
)
png_ptr
->
mode
/*SAFE*/
;
...
...
@@ -3003,7 +3100,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
case
2
:
png_ptr
->
user_chunk_cache_max
=
1
;
png_chunk_benign_error
(
png_ptr
,
"no space in chunk cache"
);
/* FALL
THROUGH */
/* FALLTHROUGH */
case
1
:
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
* chunk being skipped, now there will be a hard error below.
...
...
@@ -3012,7 +3109,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
default:
/* not at limit */
--
(
png_ptr
->
user_chunk_cache_max
);
/* FALL
THROUGH */
/* FALLTHROUGH */
case
0
:
/* no limit */
# endif
/* USER_LIMITS */
/* Here when the limit isn't reached or when limits are compiled
...
...
@@ -3063,20 +3160,61 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
*/
void
/* PRIVATE */
png_check_chunk_name
(
png_
structrp
png_ptr
,
png_uint_32
chunk_name
)
png_check_chunk_name
(
png_
const_structrp
png_ptr
,
const
png_uint_32
chunk_name
)
{
int
i
;
png_uint_32
cn
=
chunk_name
;
png_debug
(
1
,
"in png_check_chunk_name"
);
for
(
i
=
1
;
i
<=
4
;
++
i
)
{
int
c
=
c
hunk_name
&
0xff
;
int
c
=
c
n
&
0xff
;
if
(
c
<
65
||
c
>
122
||
(
c
>
90
&&
c
<
97
))
png_chunk_error
(
png_ptr
,
"invalid chunk type"
);
chunk_name
>>=
8
;
cn
>>=
8
;
}
}
void
/* PRIVATE */
png_check_chunk_length
(
png_const_structrp
png_ptr
,
const
png_uint_32
length
)
{
png_alloc_size_t
limit
=
PNG_UINT_31_MAX
;
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if
(
png_ptr
->
user_chunk_malloc_max
>
0
&&
png_ptr
->
user_chunk_malloc_max
<
limit
)
limit
=
png_ptr
->
user_chunk_malloc_max
;
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
if
(
PNG_USER_CHUNK_MALLOC_MAX
<
limit
)
limit
=
PNG_USER_CHUNK_MALLOC_MAX
;
# endif
if
(
png_ptr
->
chunk_name
==
png_IDAT
)
{
png_alloc_size_t
idat_limit
=
PNG_UINT_31_MAX
;
size_t
row_factor
=
(
size_t
)
png_ptr
->
width
*
(
size_t
)
png_ptr
->
channels
*
(
png_ptr
->
bit_depth
>
8
?
2
:
1
)
+
1
+
(
png_ptr
->
interlaced
?
6
:
0
);
if
(
png_ptr
->
height
>
PNG_UINT_32_MAX
/
row_factor
)
idat_limit
=
PNG_UINT_31_MAX
;
else
idat_limit
=
png_ptr
->
height
*
row_factor
;
row_factor
=
row_factor
>
32566
?
32566
:
row_factor
;
idat_limit
+=
6
+
5
*
(
idat_limit
/
row_factor
+
1
);
/* zlib+deflate overhead */
idat_limit
=
idat_limit
<
PNG_UINT_31_MAX
?
idat_limit
:
PNG_UINT_31_MAX
;
limit
=
limit
<
idat_limit
?
idat_limit
:
limit
;
}
if
(
length
>
limit
)
{
png_debug2
(
0
,
" length = %lu, limit = %lu"
,
(
unsigned
long
)
length
,(
unsigned
long
)
limit
);
png_chunk_error
(
png_ptr
,
"chunk data is too large"
);
}
}
...
...
@@ -3405,7 +3543,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
*/
do
{
dp
[
0
]
=
sp
[
0
]
,
dp
[
1
]
=
sp
[
1
];
dp
[
0
]
=
sp
[
0
]
;
dp
[
1
]
=
sp
[
1
];
if
(
row_width
<=
bytes_to_jump
)
return
;
...
...
@@ -3426,7 +3564,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
*/
for
(;;)
{
dp
[
0
]
=
sp
[
0
]
,
dp
[
1
]
=
sp
[
1
],
dp
[
2
]
=
sp
[
2
];
dp
[
0
]
=
sp
[
0
]
;
dp
[
1
]
=
sp
[
1
];
dp
[
2
]
=
sp
[
2
];
if
(
row_width
<=
bytes_to_jump
)
return
;
...
...
@@ -3590,8 +3728,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
case
1
:
{
png_bytep
sp
=
row
+
(
png_
size_t
)((
row_info
->
width
-
1
)
>>
3
);
png_bytep
dp
=
row
+
(
png_
size_t
)((
final_width
-
1
)
>>
3
);
png_bytep
sp
=
row
+
(
size_t
)((
row_info
->
width
-
1
)
>>
3
);
png_bytep
dp
=
row
+
(
size_t
)((
final_width
-
1
)
>>
3
);
unsigned
int
sshift
,
dshift
;
unsigned
int
s_start
,
s_end
;
int
s_inc
;
...
...
@@ -3717,8 +3855,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
case
4
:
{
png_bytep
sp
=
row
+
(
png_
size_t
)((
row_info
->
width
-
1
)
>>
1
);
png_bytep
dp
=
row
+
(
png_
size_t
)((
final_width
-
1
)
>>
1
);
png_bytep
sp
=
row
+
(
size_t
)((
row_info
->
width
-
1
)
>>
1
);
png_bytep
dp
=
row
+
(
size_t
)((
final_width
-
1
)
>>
1
);
unsigned
int
sshift
,
dshift
;
unsigned
int
s_start
,
s_end
;
int
s_inc
;
...
...
@@ -3780,12 +3918,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
default:
{
png_
size_t
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
size_t
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
png_bytep
sp
=
row
+
(
png_
size_t
)(
row_info
->
width
-
1
)
png_bytep
sp
=
row
+
(
size_t
)(
row_info
->
width
-
1
)
*
pixel_bytes
;
png_bytep
dp
=
row
+
(
png_
size_t
)(
final_width
-
1
)
*
pixel_bytes
;
png_bytep
dp
=
row
+
(
size_t
)(
final_width
-
1
)
*
pixel_bytes
;
int
jstop
=
(
int
)
png_pass_inc
[
pass
];
png_uint_32
i
;
...
...
@@ -3822,8 +3960,8 @@ static void
png_read_filter_row_sub
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_bytep
rp
=
row
+
bpp
;
...
...
@@ -3840,8 +3978,8 @@ static void
png_read_filter_row_up
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
png_
size_t
istop
=
row_info
->
rowbytes
;
size_t
i
;
size_t
istop
=
row_info
->
rowbytes
;
png_bytep
rp
=
row
;
png_const_bytep
pp
=
prev_row
;
...
...
@@ -3856,11 +3994,11 @@ static void
png_read_filter_row_avg
(
png_row_infop
row_info
,
png_bytep
row
,
png_const_bytep
prev_row
)
{
png_
size_t
i
;
size_t
i
;
png_bytep
rp
=
row
;
png_const_bytep
pp
=
prev_row
;
unsigned
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
>>
3
;
png_
size_t
istop
=
row_info
->
rowbytes
-
bpp
;
size_t
istop
=
row_info
->
rowbytes
-
bpp
;
for
(
i
=
0
;
i
<
bpp
;
i
++
)
{
...
...
@@ -3915,7 +4053,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
/* Find the best predictor, the least of pa, pb, pc favoring the earlier
* ones in the case of a tie.
*/
if
(
pb
<
pa
)
pa
=
pb
,
a
=
b
;
if
(
pb
<
pa
)
{
pa
=
pb
;
a
=
b
;
}
if
(
pc
<
pa
)
a
=
c
;
/* Calculate the current pixel in a, and move the previous row pixel to c
...
...
@@ -3967,7 +4108,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
pc
=
(
p
+
pc
)
<
0
?
-
(
p
+
pc
)
:
p
+
pc
;
#endif
if
(
pb
<
pa
)
pa
=
pb
,
a
=
b
;
if
(
pb
<
pa
)
{
pa
=
pb
;
a
=
b
;
}
if
(
pc
<
pa
)
a
=
c
;
a
+=
*
row
;
...
...
@@ -4290,7 +4434,7 @@ png_read_start_row(png_structrp png_ptr)
static
PNG_CONST
png_byte
png_pass_yinc
[
7
]
=
{
8
,
8
,
8
,
4
,
4
,
2
,
2
};
unsigned
int
max_pixel_depth
;
png_
size_t
row_bytes
;
size_t
row_bytes
;
png_debug
(
1
,
"in png_read_start_row"
);
...
...
src/share/native/sun/awt/libpng/pngset.c
浏览文件 @
a4517b4b
此差异已折叠。
点击以展开。
src/share/native/sun/awt/libpng/pngstruct.h
浏览文件 @
a4517b4b
...
...
@@ -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.
28 [January 5, 2017
]
* Copyright (c) 1998-2002,2004,2006-201
7
Glenn Randers-Pehrson
* Last changed in libpng 1.6.
35 [July 15, 2018
]
* Copyright (c) 1998-2002,2004,2006-201
8
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.)
*
...
...
@@ -75,7 +75,7 @@
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximu
um for png_size_t. The value can be overri
den in a library build
* maximu
m for size_t. The value can be overrid
den in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
...
...
@@ -242,7 +242,7 @@ struct png_struct_def
png_uint_32
height
;
/* height of image in pixels */
png_uint_32
num_rows
;
/* number of rows in current pass */
png_uint_32
usr_width
;
/* width of row at start of write */
png_size_t
rowbytes
;
/* size of row in bytes */
size_t
rowbytes
;
/* size of row in bytes */
png_uint_32
iwidth
;
/* width of current interlaced row in pixels */
png_uint_32
row_number
;
/* current row in interlace pass */
png_uint_32
chunk_name
;
/* PNG_CHUNK() id of current chunk */
...
...
@@ -260,7 +260,7 @@ struct png_struct_def
png_bytep
try_row
;
/* buffer to save trial row when filtering */
png_bytep
tst_row
;
/* buffer to save best trial row when filtering */
#endif
png_size_t
info_rowbytes
;
/* Added in 1.5.4: cache of updated row bytes */
size_t
info_rowbytes
;
/* Added in 1.5.4: cache of updated row bytes */
png_uint_32
idat_size
;
/* current IDAT size for read */
png_uint_32
crc
;
/* current chunk CRC value */
...
...
@@ -335,7 +335,7 @@ struct png_struct_def
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8
shift
;
/* shift for significant bit tranformation */
png_color_8
shift
;
/* shift for significant bit tran
s
formation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
...
...
@@ -356,10 +356,10 @@ struct png_struct_def
png_bytep
current_buffer
;
/* buffer for recently used data */
png_uint_32
push_length
;
/* size of current input chunk */
png_uint_32
skip_length
;
/* bytes to skip in input data */
png_size_t
save_buffer_size
;
/* amount of data now in save_buffer */
png_size_t
save_buffer_max
;
/* total size of save_buffer */
png_size_t
buffer_size
;
/* total amount of available input data */
png_size_t
current_buffer_size
;
/* amount of data now in current_buffer */
size_t
save_buffer_size
;
/* amount of data now in save_buffer */
size_t
save_buffer_max
;
/* total size of save_buffer */
size_t
buffer_size
;
/* total amount of available input data */
size_t
current_buffer_size
;
/* amount of data now in current_buffer */
int
process_mode
;
/* what push library is currently doing */
int
cur_palette
;
/* current push library palette index */
...
...
@@ -479,7 +479,7 @@ struct png_struct_def
#endif
/* New member added in libpng-1.2.26 */
png_
size_t
old_big_row_buf_size
;
size_t
old_big_row_buf_size
;
#ifdef PNG_READ_SUPPORTED
/* New member added in libpng-1.2.30 */
...
...
src/share/native/sun/awt/libpng/pngtrans.c
浏览文件 @
a4517b4b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录