Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
fbe3e002
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
大约 1 年 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fbe3e002
编写于
9月 30, 2016
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'libpng16' of
git://github.com/jbowler/libpng
into libpng16
上级
b5b77a72
319c9852
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
52 addition
and
21 deletion
+52
-21
contrib/libtests/pngunknown.c
contrib/libtests/pngunknown.c
+1
-1
contrib/libtests/pngvalid.c
contrib/libtests/pngvalid.c
+26
-13
pngpriv.h
pngpriv.h
+18
-0
pngread.c
pngread.c
+2
-2
pngtrans.c
pngtrans.c
+1
-1
pngwrite.c
pngwrite.c
+4
-4
未找到文件。
contrib/libtests/pngunknown.c
浏览文件 @
fbe3e002
...
@@ -478,7 +478,7 @@ get_valid(display *d, png_infop info_ptr)
...
@@ -478,7 +478,7 @@ get_valid(display *d, png_infop info_ptr)
png_textp
text
;
png_textp
text
;
png_uint_32
ntext
=
png_get_text
(
d
->
png_ptr
,
info_ptr
,
&
text
,
NULL
);
png_uint_32
ntext
=
png_get_text
(
d
->
png_ptr
,
info_ptr
,
&
text
,
NULL
);
while
(
ntext
--
>
0
)
switch
(
text
[
ntext
].
compression
)
while
(
ntext
>
0
)
switch
(
text
[
--
ntext
].
compression
)
{
{
case
-
1
:
case
-
1
:
flags
|=
PNG_INFO_tEXt
;
flags
|=
PNG_INFO_tEXt
;
...
...
contrib/libtests/pngvalid.c
浏览文件 @
fbe3e002
...
@@ -1242,7 +1242,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
...
@@ -1242,7 +1242,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
image
+=
2
;
/* skip image first row markers */
image
+=
2
;
/* skip image first row markers */
while
(
rows
--
>
0
)
for
(;
rows
>
0
;
--
rows
)
{
{
if
(
image
[
-
2
]
!=
190
||
image
[
-
1
]
!=
239
)
if
(
image
[
-
2
]
!=
190
||
image
[
-
1
]
!=
239
)
png_error
(
pp
,
"row start overwritten"
);
png_error
(
pp
,
"row start overwritten"
);
...
@@ -11427,23 +11427,36 @@ perform_interlace_macro_validation(void)
...
@@ -11427,23 +11427,36 @@ perform_interlace_macro_validation(void)
*/
*/
for
(
v
=
0
;;)
for
(
v
=
0
;;)
{
{
/* The first two tests overflow if the pass row or column is outside
* the possible range for a 32-bit result. In fact the values should
* never be outside the range for a 31-bit result, but checking for 32
* bits here ensures that if an app uses a bogus pass row or column
* (just so long as it fits in a 32 bit integer) it won't get a
* possibly dangerous overflow.
*/
/* First the base 0 stuff: */
/* First the base 0 stuff: */
m
=
PNG_ROW_FROM_PASS_ROW
(
v
,
pass
);
if
(
v
<
png_pass_rows
(
0xFFFFFFFFU
,
pass
))
f
=
png_row_from_pass_row
(
v
,
pass
);
if
(
m
!=
f
)
{
{
fprintf
(
stderr
,
"PNG_ROW_FROM_PASS_ROW(%u, %d) = %u != %x
\n
"
,
m
=
PNG_ROW_FROM_PASS_ROW
(
v
,
pass
);
v
,
pass
,
m
,
f
);
f
=
png_row_from_pass_row
(
v
,
pass
);
exit
(
99
);
if
(
m
!=
f
)
{
fprintf
(
stderr
,
"PNG_ROW_FROM_PASS_ROW(%u, %d) = %u != %x
\n
"
,
v
,
pass
,
m
,
f
);
exit
(
99
);
}
}
}
m
=
PNG_COL_FROM_PASS_COL
(
v
,
pass
);
if
(
v
<
png_pass_cols
(
0xFFFFFFFFU
,
pass
))
f
=
png_col_from_pass_col
(
v
,
pass
);
if
(
m
!=
f
)
{
{
fprintf
(
stderr
,
"PNG_COL_FROM_PASS_COL(%u, %d) = %u != %x
\n
"
,
m
=
PNG_COL_FROM_PASS_COL
(
v
,
pass
);
v
,
pass
,
m
,
f
);
f
=
png_col_from_pass_col
(
v
,
pass
);
exit
(
99
);
if
(
m
!=
f
)
{
fprintf
(
stderr
,
"PNG_COL_FROM_PASS_COL(%u, %d) = %u != %x
\n
"
,
v
,
pass
,
m
,
f
);
exit
(
99
);
}
}
}
m
=
PNG_ROW_IN_INTERLACE_PASS
(
v
,
pass
);
m
=
PNG_ROW_IN_INTERLACE_PASS
(
v
,
pass
);
...
...
pngpriv.h
浏览文件 @
fbe3e002
...
@@ -669,6 +669,24 @@
...
@@ -669,6 +669,24 @@
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
(( ((png_size_t)(width) * ((png_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
* width) % 8, but that would overflow for large 'width'. The second macro is
* the same except that it returns the number of unused bits in the last byte;
* (8-TRAILBITS), but 0 when TRAILBITS is 0.
*
* NOTE: these macros are intended to be self-evidently correct and never
* overflow on the assumption that pixel_bits is in the range 0..255. The
* arguments are evaluated only once and they can be signed (e.g. as a result of
* the integral promotions). The result of the expression always has type
* (png_uint_32), however the compiler always knows it is in the range 0..7.
*/
#define PNG_TRAILBITS(pixel_bits, width) \
(((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
#define PNG_PADBITS(pixel_bits, width) \
((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
/* PNG_OUT_OF_RANGE returns true if value is outside the range
/* PNG_OUT_OF_RANGE returns true if value is outside the range
* ideal-delta..ideal+delta. Each argument is evaluated twice.
* ideal-delta..ideal+delta. Each argument is evaluated twice.
* "ideal" and "delta" should be constants, normally simple
* "ideal" and "delta" should be constants, normally simple
...
...
pngread.c
浏览文件 @
fbe3e002
...
@@ -3231,7 +3231,7 @@ png_image_read_colormapped(png_voidp argument)
...
@@ -3231,7 +3231,7 @@ png_image_read_colormapped(png_voidp argument)
png_uint_32
y
=
image
->
height
;
png_uint_32
y
=
image
->
height
;
png_bytep
row
=
png_voidcast
(
png_bytep
,
display
->
first_row
);
png_bytep
row
=
png_voidcast
(
png_bytep
,
display
->
first_row
);
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_read_row
(
png_ptr
,
row
,
NULL
);
png_read_row
(
png_ptr
,
row
,
NULL
);
row
+=
row_bytes
;
row
+=
row_bytes
;
...
@@ -4064,7 +4064,7 @@ png_image_read_direct(png_voidp argument)
...
@@ -4064,7 +4064,7 @@ png_image_read_direct(png_voidp argument)
png_uint_32
y
=
image
->
height
;
png_uint_32
y
=
image
->
height
;
png_bytep
row
=
png_voidcast
(
png_bytep
,
display
->
first_row
);
png_bytep
row
=
png_voidcast
(
png_bytep
,
display
->
first_row
);
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_read_row
(
png_ptr
,
row
,
NULL
);
png_read_row
(
png_ptr
,
row
,
NULL
);
row
+=
row_bytes
;
row
+=
row_bytes
;
...
...
pngtrans.c
浏览文件 @
fbe3e002
...
@@ -693,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
...
@@ -693,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* and this calculation is used because it avoids warnings that other
* and this calculation is used because it avoids warnings that other
* forms produced on either GCC or MSVC.
* forms produced on either GCC or MSVC.
*/
*/
int
padding
=
((
256
-
row_info
->
pixel_depth
)
*
(
row_info
->
width
&
7
))
&
7
;
int
padding
=
PNG_PADBITS
(
row_info
->
pixel_depth
,
row_info
->
width
)
;
png_bytep
rp
=
png_ptr
->
row_buf
+
row_info
->
rowbytes
;
png_bytep
rp
=
png_ptr
->
row_buf
+
row_info
->
rowbytes
;
switch
(
row_info
->
bit_depth
)
switch
(
row_info
->
bit_depth
)
...
...
pngwrite.c
浏览文件 @
fbe3e002
...
@@ -1554,7 +1554,7 @@ png_write_image_16bit(png_voidp argument)
...
@@ -1554,7 +1554,7 @@ png_write_image_16bit(png_voidp argument)
*/
*/
row_end
=
output_row
+
image
->
width
*
(
channels
+
1
);
row_end
=
output_row
+
image
->
width
*
(
channels
+
1
);
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_const_uint_16p
in_ptr
=
input_row
;
png_const_uint_16p
in_ptr
=
input_row
;
png_uint_16p
out_ptr
=
output_row
;
png_uint_16p
out_ptr
=
output_row
;
...
@@ -1705,7 +1705,7 @@ png_write_image_8bit(png_voidp argument)
...
@@ -1705,7 +1705,7 @@ png_write_image_8bit(png_voidp argument)
/* Use row_end in place of a loop counter: */
/* Use row_end in place of a loop counter: */
row_end
=
output_row
+
image
->
width
*
(
channels
+
1
);
row_end
=
output_row
+
image
->
width
*
(
channels
+
1
);
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_const_uint_16p
in_ptr
=
input_row
;
png_const_uint_16p
in_ptr
=
input_row
;
png_bytep
out_ptr
=
output_row
;
png_bytep
out_ptr
=
output_row
;
...
@@ -1746,7 +1746,7 @@ png_write_image_8bit(png_voidp argument)
...
@@ -1746,7 +1746,7 @@ png_write_image_8bit(png_voidp argument)
*/
*/
png_bytep
row_end
=
output_row
+
image
->
width
*
channels
;
png_bytep
row_end
=
output_row
+
image
->
width
*
channels
;
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_const_uint_16p
in_ptr
=
input_row
;
png_const_uint_16p
in_ptr
=
input_row
;
png_bytep
out_ptr
=
output_row
;
png_bytep
out_ptr
=
output_row
;
...
@@ -2136,7 +2136,7 @@ png_image_write_main(png_voidp argument)
...
@@ -2136,7 +2136,7 @@ png_image_write_main(png_voidp argument)
ptrdiff_t
row_bytes
=
display
->
row_bytes
;
ptrdiff_t
row_bytes
=
display
->
row_bytes
;
png_uint_32
y
=
image
->
height
;
png_uint_32
y
=
image
->
height
;
while
(
y
--
>
0
)
for
(;
y
>
0
;
--
y
)
{
{
png_write_row
(
png_ptr
,
row
);
png_write_row
(
png_ptr
,
row
);
row
+=
row_bytes
;
row
+=
row_bytes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录