Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
04a845ca
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
04a845ca
编写于
9月 30, 2011
作者:
L
Laurent Aimar
提交者:
Janne Grunau
10月 10, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tiffdec: fix out of bound reads/writes
Signed-off-by:
N
Janne Grunau
<
janne-libav@jannau.net
>
上级
46cb2f6a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
15 deletion
+25
-15
libavcodec/tiff.c
libavcodec/tiff.c
+25
-15
未找到文件。
libavcodec/tiff.c
浏览文件 @
04a845ca
...
...
@@ -173,6 +173,8 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
}
switch
(
s
->
compr
){
case
TIFF_RAW
:
if
(
ssrc
+
size
-
src
<
width
)
return
AVERROR_INVALIDDATA
;
if
(
!
s
->
fill_order
)
{
memcpy
(
dst
,
src
,
width
);
}
else
{
...
...
@@ -280,6 +282,8 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
uint32_t
*
pal
;
const
uint8_t
*
rp
,
*
gp
,
*
bp
;
if
(
end_buf
-
buf
<
12
)
return
-
1
;
tag
=
tget_short
(
&
buf
,
s
->
le
);
type
=
tget_short
(
&
buf
,
s
->
le
);
count
=
tget_long
(
&
buf
,
s
->
le
);
...
...
@@ -339,7 +343,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case
TIFF_SHORT
:
case
TIFF_LONG
:
s
->
bpp
=
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
s
->
bpp
+=
tget
(
&
buf
,
type
,
s
->
le
);
for
(
i
=
0
;
i
<
count
&&
buf
<
end_buf
;
i
++
)
s
->
bpp
+=
tget
(
&
buf
,
type
,
s
->
le
);
break
;
default:
s
->
bpp
=
-
1
;
...
...
@@ -453,6 +457,8 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case
TIFF_PAL
:
pal
=
(
uint32_t
*
)
s
->
palette
;
off
=
type_sizes
[
type
];
if
(
count
/
3
>
256
||
end_buf
-
buf
<
count
/
3
*
off
*
3
)
return
-
1
;
rp
=
buf
;
gp
=
buf
+
count
/
3
*
off
;
bp
=
buf
+
count
/
3
*
off
*
2
;
...
...
@@ -495,12 +501,16 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame
*
picture
=
data
;
AVFrame
*
const
p
=
(
AVFrame
*
)
&
s
->
picture
;
const
uint8_t
*
orig_buf
=
buf
,
*
end_buf
=
buf
+
buf_size
;
int
id
,
le
,
off
,
ret
;
unsigned
off
;
int
id
,
le
,
ret
;
int
i
,
j
,
entries
;
int
stride
,
soff
,
ssize
;
int
stride
;
unsigned
soff
,
ssize
;
uint8_t
*
dst
;
//parse image header
if
(
end_buf
-
buf
<
8
)
return
AVERROR_INVALIDDATA
;
id
=
AV_RL16
(
buf
);
buf
+=
2
;
if
(
id
==
0x4949
)
le
=
1
;
else
if
(
id
==
0x4D4D
)
le
=
0
;
...
...
@@ -520,9 +530,9 @@ static int decode_frame(AVCodecContext *avctx,
}
/* parse image file directory */
off
=
tget_long
(
&
buf
,
le
);
if
(
orig_buf
+
off
+
14
>=
end_buf
)
{
if
(
off
>=
UINT_MAX
-
14
||
end_buf
-
orig_buf
<
off
+
14
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"IFD offset is greater than image size
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
buf
=
orig_buf
+
off
;
entries
=
tget_short
(
&
buf
,
le
);
...
...
@@ -546,23 +556,23 @@ static int decode_frame(AVCodecContext *avctx,
stride
=
p
->
linesize
[
0
];
dst
=
p
->
data
[
0
];
for
(
i
=
0
;
i
<
s
->
height
;
i
+=
s
->
rps
){
if
(
s
->
stripsizes
)
if
(
s
->
stripsizes
)
{
if
(
s
->
stripsizes
>=
end_buf
)
return
AVERROR_INVALIDDATA
;
ssize
=
tget
(
&
s
->
stripsizes
,
s
->
sstype
,
s
->
le
);
else
}
else
ssize
=
s
->
stripsize
;
if
(
ssize
>
buf_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Buffer size is smaller than strip size
\n
"
);
return
-
1
;
}
if
(
s
->
stripdata
){
if
(
s
->
stripdata
>=
end_buf
)
return
AVERROR_INVALIDDATA
;
soff
=
tget
(
&
s
->
stripdata
,
s
->
sot
,
s
->
le
);
}
else
soff
=
s
->
stripoff
;
if
(
soff
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid stripoff: %d
\n
"
,
soff
);
return
AVERROR
(
EINVAL
);
if
(
soff
>
buf_size
||
ssize
>
buf_size
-
soff
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid strip size/offset
\n
"
);
return
-
1
;
}
if
(
tiff_unpack_strip
(
s
,
dst
,
stride
,
orig_buf
+
soff
,
ssize
,
FFMIN
(
s
->
rps
,
s
->
height
-
i
))
<
0
)
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录