Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
b1306823
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,发现更多精彩内容 >>
提交
b1306823
编写于
12月 17, 2014
作者:
V
Vittorio Giovara
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
check memory errors from av_strdup()
上级
9745f19f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
8 deletion
+32
-8
avconv_opt.c
avconv_opt.c
+2
-0
avprobe.c
avprobe.c
+4
-0
cmdutils.c
cmdutils.c
+9
-1
libavformat/matroskaenc.c
libavformat/matroskaenc.c
+12
-4
libavutil/opt.c
libavutil/opt.c
+5
-3
未找到文件。
avconv_opt.c
浏览文件 @
b1306823
...
...
@@ -213,6 +213,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
arg
++
;
}
map
=
av_strdup
(
arg
);
if
(
!
map
)
return
AVERROR
(
ENOMEM
);
/* parse sync stream first, just pick first matching stream */
if
(
sync
=
strchr
(
map
,
','
))
{
...
...
avprobe.c
浏览文件 @
b1306823
...
...
@@ -302,6 +302,8 @@ static void old_print_object_header(const char *name)
return
;
str
=
p
=
av_strdup
(
name
);
if
(
!
str
)
return
;
while
(
*
p
)
{
*
p
=
av_toupper
(
*
p
);
p
++
;
...
...
@@ -319,6 +321,8 @@ static void old_print_object_footer(const char *name)
return
;
str
=
p
=
av_strdup
(
name
);
if
(
!
str
)
return
;
while
(
*
p
)
{
*
p
=
av_toupper
(
*
p
);
p
++
;
...
...
cmdutils.c
浏览文件 @
b1306823
...
...
@@ -261,10 +261,14 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
if
(
po
->
flags
&
OPT_SPEC
)
{
SpecifierOpt
**
so
=
dst
;
char
*
p
=
strchr
(
opt
,
':'
);
char
*
str
;
dstcount
=
(
int
*
)(
so
+
1
);
*
so
=
grow_array
(
*
so
,
sizeof
(
**
so
),
dstcount
,
*
dstcount
+
1
);
(
*
so
)[
*
dstcount
-
1
].
specifier
=
av_strdup
(
p
?
p
+
1
:
""
);
str
=
av_strdup
(
p
?
p
+
1
:
""
);
if
(
!
str
)
return
AVERROR
(
ENOMEM
);
(
*
so
)[
*
dstcount
-
1
].
specifier
=
str
;
dst
=
&
(
*
so
)[
*
dstcount
-
1
].
u
;
}
...
...
@@ -272,6 +276,8 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
char
*
str
;
str
=
av_strdup
(
arg
);
av_freep
(
dst
);
if
(
!
str
)
return
AVERROR
(
ENOMEM
);
*
(
char
**
)
dst
=
str
;
}
else
if
(
po
->
flags
&
OPT_BOOL
||
po
->
flags
&
OPT_INT
)
{
*
(
int
*
)
dst
=
parse_number_or_die
(
opt
,
arg
,
OPT_INT64
,
INT_MIN
,
INT_MAX
);
...
...
@@ -1350,6 +1356,8 @@ int show_help(void *optctx, const char *opt, const char *arg)
av_log_set_callback
(
log_callback_help
);
topic
=
av_strdup
(
arg
?
arg
:
""
);
if
(
!
topic
)
return
AVERROR
(
ENOMEM
);
par
=
strchr
(
topic
,
'='
);
if
(
par
)
*
par
++
=
0
;
...
...
libavformat/matroskaenc.c
浏览文件 @
b1306823
...
...
@@ -936,13 +936,16 @@ static int mkv_write_chapters(AVFormatContext *s)
return
0
;
}
static
void
mkv_write_simpletag
(
AVIOContext
*
pb
,
AVDictionaryEntry
*
t
)
static
int
mkv_write_simpletag
(
AVIOContext
*
pb
,
AVDictionaryEntry
*
t
)
{
uint8_t
*
key
=
av_strdup
(
t
->
key
);
uint8_t
*
p
=
key
;
const
uint8_t
*
lang
=
NULL
;
ebml_master
tag
;
if
(
!
key
)
return
AVERROR
(
ENOMEM
);
if
((
p
=
strrchr
(
p
,
'-'
))
&&
(
lang
=
av_convert_lang_to
(
p
+
1
,
AV_LANG_ISO639_2_BIBL
)))
*
p
=
0
;
...
...
@@ -964,6 +967,7 @@ static void mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)
end_ebml_master
(
pb
,
tag
);
av_freep
(
&
key
);
return
0
;
}
static
int
mkv_write_tag
(
AVFormatContext
*
s
,
AVDictionary
*
m
,
unsigned
int
elementid
,
...
...
@@ -987,10 +991,14 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme
put_ebml_uint
(
s
->
pb
,
elementid
,
uid
);
end_ebml_master
(
s
->
pb
,
targets
);
while
((
t
=
av_dict_get
(
m
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
while
((
t
=
av_dict_get
(
m
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
{
if
(
av_strcasecmp
(
t
->
key
,
"title"
)
&&
av_strcasecmp
(
t
->
key
,
"encoding_tool"
))
mkv_write_simpletag
(
s
->
pb
,
t
);
av_strcasecmp
(
t
->
key
,
"encoding_tool"
))
{
ret
=
mkv_write_simpletag
(
s
->
pb
,
t
);
if
(
ret
<
0
)
return
ret
;
}
}
end_ebml_master
(
s
->
pb
,
tag
);
return
0
;
...
...
libavutil/opt.c
浏览文件 @
b1306823
...
...
@@ -138,7 +138,7 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d
{
av_freep
(
dst
);
*
dst
=
av_strdup
(
val
);
return
0
;
return
*
dst
?
0
:
AVERROR
(
ENOMEM
)
;
}
#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
...
...
@@ -350,7 +350,7 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
*
out_val
=
av_strdup
(
*
(
uint8_t
**
)
dst
);
else
*
out_val
=
av_strdup
(
""
);
return
0
;
return
*
out_val
?
0
:
AVERROR
(
ENOMEM
)
;
case
AV_OPT_TYPE_BINARY
:
len
=
*
(
int
*
)(((
uint8_t
*
)
dst
)
+
sizeof
(
uint8_t
*
));
if
((
uint64_t
)
len
*
2
+
1
>
INT_MAX
)
...
...
@@ -368,7 +368,7 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
if
(
ret
>=
sizeof
(
buf
))
return
AVERROR
(
EINVAL
);
*
out_val
=
av_strdup
(
buf
);
return
0
;
return
*
out_val
?
0
:
AVERROR
(
ENOMEM
)
;
}
static
int
get_number
(
void
*
obj
,
const
char
*
name
,
double
*
num
,
int
*
den
,
int64_t
*
intnum
,
...
...
@@ -828,6 +828,8 @@ int main(void)
test_ctx
.
class
=
&
test_class
;
av_opt_set_defaults
(
&
test_ctx
);
test_ctx
.
string
=
av_strdup
(
"default"
);
if
(
!
test_ctx
.
string
)
return
AVERROR
(
ENOMEM
);
av_log_set_level
(
AV_LOG_DEBUG
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录