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
e34c6c97
Commit
e34c6c97
authored
Oct 27, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cook: check output buffer size before decoding
parent
6631294c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
cook.c
libavcodec/cook.c
+9
-3
No files found.
libavcodec/cook.c
View file @
e34c6c97
...
...
@@ -955,13 +955,20 @@ static int cook_decode_frame(AVCodecContext *avctx,
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
COOKContext
*
q
=
avctx
->
priv_data
;
int
i
;
int
i
,
out_size
;
int
offset
=
0
;
int
chidx
=
0
;
if
(
buf_size
<
avctx
->
block_align
)
return
buf_size
;
out_size
=
q
->
nb_channels
*
q
->
samples_per_channel
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
if
(
*
data_size
<
out_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
/* estimate subpacket sizes */
q
->
subpacket
[
0
].
size
=
avctx
->
block_align
;
...
...
@@ -984,8 +991,7 @@ static int cook_decode_frame(AVCodecContext *avctx,
chidx
+=
q
->
subpacket
[
i
].
num_channels
;
av_log
(
avctx
,
AV_LOG_DEBUG
,
"subpacket[%i] %i %i
\n
"
,
i
,
q
->
subpacket
[
i
].
size
*
8
,
get_bits_count
(
&
q
->
gb
));
}
*
data_size
=
q
->
nb_channels
*
q
->
samples_per_channel
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
*
data_size
=
out_size
;
/* Discard the first two frames: no valid audio. */
if
(
avctx
->
frame_number
<
2
)
*
data_size
=
0
;
...
...
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