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
4315c7d3
Commit
4315c7d3
authored
Oct 31, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apedec: check output buffer size after calculating actual output size
parent
ad17207b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
apedec.c
libavcodec/apedec.c
+10
-8
No files found.
libavcodec/apedec.c
View file @
4315c7d3
...
...
@@ -816,15 +816,9 @@ static int ape_decode_frame(AVCodecContext *avctx,
int16_t
*
samples
=
data
;
uint32_t
nblocks
;
int
i
;
int
blockstodecode
;
int
blockstodecode
,
out_size
;
int
bytes_used
;
/* should not happen but who knows */
if
(
BLOCKS_PER_LOOP
*
2
*
avctx
->
channels
>
*
data_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Output buffer is too small.
\n
"
);
return
AVERROR
(
EINVAL
);
}
/* this should never be negative, but bad things will happen if it is, so
check it just to make sure. */
av_assert0
(
s
->
samples
>=
0
);
...
...
@@ -883,6 +877,13 @@ static int ape_decode_frame(AVCodecContext *avctx,
nblocks
=
s
->
samples
;
blockstodecode
=
FFMIN
(
BLOCKS_PER_LOOP
,
nblocks
);
out_size
=
blockstodecode
*
avctx
->
channels
*
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
);
}
s
->
error
=
0
;
if
((
s
->
channels
==
1
)
||
(
s
->
frameflags
&
APE_FRAMECODE_PSEUDO_STEREO
))
...
...
@@ -905,9 +906,10 @@ static int ape_decode_frame(AVCodecContext *avctx,
s
->
samples
-=
blockstodecode
;
*
data_size
=
blockstodecode
*
2
*
s
->
channels
;
bytes_used
=
s
->
samples
?
s
->
ptr
-
s
->
last_ptr
:
buf_size
;
s
->
last_ptr
=
s
->
ptr
;
*
data_size
=
out_size
;
return
bytes_used
;
}
...
...
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