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
60aa1a35
Commit
60aa1a35
authored
Sep 23, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vorbisdec: check output buffer size before writing output
parent
d2604f92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
vorbisdec.c
libavcodec/vorbisdec.c
+9
-3
No files found.
libavcodec/vorbisdec.c
View file @
60aa1a35
...
...
@@ -1607,7 +1607,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
vorbis_context
*
vc
=
avccontext
->
priv_data
;
GetBitContext
*
gb
=
&
(
vc
->
gb
);
const
float
*
channel_ptrs
[
255
];
int
i
,
len
;
int
i
,
len
,
out_size
;
if
(
!
buf_size
)
return
0
;
...
...
@@ -1632,6 +1632,13 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
av_dlog
(
NULL
,
"parsed %d bytes %d bits, returned %d samples (*ch*bits)
\n
"
,
get_bits_count
(
gb
)
/
8
,
get_bits_count
(
gb
)
%
8
,
len
);
out_size
=
len
*
vc
->
audio_channels
*
av_get_bytes_per_sample
(
avccontext
->
sample_fmt
);
if
(
*
data_size
<
out_size
)
{
av_log
(
avccontext
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
vc
->
audio_channels
>
8
)
{
for
(
i
=
0
;
i
<
vc
->
audio_channels
;
i
++
)
channel_ptrs
[
i
]
=
vc
->
channel_floors
+
i
*
len
;
...
...
@@ -1647,8 +1654,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
vc
->
fmt_conv
.
float_to_int16_interleave
(
data
,
channel_ptrs
,
len
,
vc
->
audio_channels
);
*
data_size
=
len
*
vc
->
audio_channels
*
av_get_bytes_per_sample
(
avccontext
->
sample_fmt
);
*
data_size
=
out_size
;
return
buf_size
;
}
...
...
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