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
e83ffb48
Commit
e83ffb48
authored
Jul 08, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/utils: Check values in apply_param_change()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
656e9a68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
utils.c
libavcodec/utils.c
+13
-2
No files found.
libavcodec/utils.c
View file @
e83ffb48
...
...
@@ -2257,6 +2257,7 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
int
size
=
0
,
ret
;
const
uint8_t
*
data
;
uint32_t
flags
;
int64_t
val
;
data
=
av_packet_get_side_data
(
avpkt
,
AV_PKT_DATA_PARAM_CHANGE
,
&
size
);
if
(
!
data
)
...
...
@@ -2277,7 +2278,12 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
if
(
flags
&
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT
)
{
if
(
size
<
4
)
goto
fail
;
avctx
->
channels
=
bytestream_get_le32
(
&
data
);
val
=
bytestream_get_le32
(
&
data
);
if
(
val
<=
0
||
val
>
INT_MAX
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid channel count"
);
return
AVERROR_INVALIDDATA
;
}
avctx
->
channels
=
val
;
size
-=
4
;
}
if
(
flags
&
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT
)
{
...
...
@@ -2289,7 +2295,12 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
if
(
flags
&
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
)
{
if
(
size
<
4
)
goto
fail
;
avctx
->
sample_rate
=
bytestream_get_le32
(
&
data
);
val
=
bytestream_get_le32
(
&
data
);
if
(
val
<=
0
||
val
>
INT_MAX
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid sample rate"
);
return
AVERROR_INVALIDDATA
;
}
avctx
->
sample_rate
=
val
;
size
-=
4
;
}
if
(
flags
&
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
)
{
...
...
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