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
754ebd1a
Commit
754ebd1a
authored
Dec 19, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adxenc: check output buffer size before writing
parent
1fb47728
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
adxenc.c
libavcodec/adxenc.c
+14
-2
No files found.
libavcodec/adxenc.c
View file @
754ebd1a
...
...
@@ -87,6 +87,9 @@ static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize)
{
ADXContext
*
c
=
avctx
->
priv_data
;
if
(
bufsize
<
HEADER_SIZE
)
return
AVERROR
(
EINVAL
);
bytestream_put_be16
(
&
buf
,
0x8000
);
/* header signature */
bytestream_put_be16
(
&
buf
,
HEADER_SIZE
-
4
);
/* copyright offset */
bytestream_put_byte
(
&
buf
,
3
);
/* encoding */
...
...
@@ -140,10 +143,19 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
int
ch
;
if
(
!
c
->
header_parsed
)
{
int
hdrsize
=
adx_encode_header
(
avctx
,
dst
,
buf_size
);
dst
+=
hdrsize
;
int
hdrsize
;
if
((
hdrsize
=
adx_encode_header
(
avctx
,
dst
,
buf_size
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
dst
+=
hdrsize
;
buf_size
-=
hdrsize
;
c
->
header_parsed
=
1
;
}
if
(
buf_size
<
BLOCK_SIZE
*
avctx
->
channels
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
adx_encode
(
c
,
dst
,
samples
+
ch
,
&
c
->
prev
[
ch
],
avctx
->
channels
);
...
...
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