Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d40dc641
Commit
d40dc641
authored
Sep 30, 2018
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/opt: check for minimum and maximum values when setting AV_OPT_TYPE_DURATION fields
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
3bfd409e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
opt.c
libavutil/opt.c
+14
-7
No files found.
libavutil/opt.c
View file @
d40dc641
...
...
@@ -496,15 +496,22 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
case
AV_OPT_TYPE_SAMPLE_FMT
:
return
set_string_sample_fmt
(
obj
,
o
,
val
,
dst
);
case
AV_OPT_TYPE_DURATION
:
if
(
!
val
)
{
*
(
int64_t
*
)
dst
=
0
;
return
0
;
}
else
{
if
((
ret
=
av_parse_time
(
dst
,
val
,
1
))
<
0
)
{
int64_t
usecs
=
0
;
if
(
val
)
{
if
((
ret
=
av_parse_time
(
&
usecs
,
val
,
1
))
<
0
)
{
av_log
(
obj
,
AV_LOG_ERROR
,
"Unable to parse option value
\"
%s
\"
as duration
\n
"
,
val
);
return
ret
;
}
break
;
}
if
(
usecs
<
o
->
min
||
usecs
>
o
->
max
)
{
av_log
(
obj
,
AV_LOG_ERROR
,
"Value %f for parameter '%s' out of range [%g - %g]
\n
"
,
usecs
/
1000000
.
0
,
o
->
name
,
o
->
min
/
1000000
.
0
,
o
->
max
/
1000000
.
0
);
return
AVERROR
(
ERANGE
);
}
*
(
int64_t
*
)
dst
=
usecs
;
return
0
;
}
case
AV_OPT_TYPE_COLOR
:
return
set_string_color
(
obj
,
o
,
val
,
dst
);
case
AV_OPT_TYPE_CHANNEL_LAYOUT
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment