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
c8b5c4d2
Commit
c8b5c4d2
authored
Sep 13, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpc7: check output buffer size before decoding
parent
fac6b7f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
mpc7.c
libavcodec/mpc7.c
+8
-2
No files found.
libavcodec/mpc7.c
View file @
c8b5c4d2
...
...
@@ -197,7 +197,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx,
int
i
,
ch
;
int
mb
=
-
1
;
Band
*
bands
=
c
->
bands
;
int
off
;
int
off
,
out_size
;
int
bits_used
,
bits_avail
;
memset
(
bands
,
0
,
sizeof
(
bands
));
...
...
@@ -205,6 +205,12 @@ static int mpc7_decode_frame(AVCodecContext * avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Too small buffer passed (%i bytes)
\n
"
,
buf_size
);
}
out_size
=
(
buf
[
1
]
?
c
->
lastframelen
:
MPC_FRAME_SIZE
)
*
4
;
if
(
*
data_size
<
out_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
bits
=
av_malloc
(((
buf_size
-
1
)
&
~
3
)
+
FF_INPUT_BUFFER_PADDING_SIZE
);
c
->
dsp
.
bswap_buf
((
uint32_t
*
)
bits
,
(
const
uint32_t
*
)(
buf
+
4
),
(
buf_size
-
4
)
>>
2
);
init_get_bits
(
&
gb
,
bits
,
(
buf_size
-
4
)
*
8
);
...
...
@@ -277,7 +283,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx,
*
data_size
=
0
;
return
buf_size
;
}
*
data_size
=
(
buf
[
1
]
?
c
->
lastframelen
:
MPC_FRAME_SIZE
)
*
4
;
*
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