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
684e3d2e
Commit
684e3d2e
authored
Mar 10, 2013
by
Janne Grunau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ra144: check buffer size before requesting a buffer
Return an error on incomplete frames.
parent
08149b2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
ra144dec.c
libavcodec/ra144dec.c
+7
-6
No files found.
libavcodec/ra144dec.c
View file @
684e3d2e
...
@@ -76,6 +76,13 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -76,6 +76,13 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
RA144Context
*
ractx
=
avctx
->
priv_data
;
RA144Context
*
ractx
=
avctx
->
priv_data
;
GetBitContext
gb
;
GetBitContext
gb
;
if
(
buf_size
<
FRAMESIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Frame too small (%d bytes). Truncated file?
\n
"
,
buf_size
);
*
got_frame_ptr
=
0
;
return
AVERROR_INVALIDDATA
;
}
/* get output buffer */
/* get output buffer */
frame
->
nb_samples
=
NBLOCKS
*
BLOCKSIZE
;
frame
->
nb_samples
=
NBLOCKS
*
BLOCKSIZE
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
0
))
<
0
)
{
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
0
))
<
0
)
{
...
@@ -84,12 +91,6 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -84,12 +91,6 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
}
}
samples
=
(
int16_t
*
)
frame
->
data
[
0
];
samples
=
(
int16_t
*
)
frame
->
data
[
0
];
if
(
buf_size
<
FRAMESIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Frame too small (%d bytes). Truncated file?
\n
"
,
buf_size
);
*
got_frame_ptr
=
0
;
return
buf_size
;
}
init_get_bits
(
&
gb
,
buf
,
FRAMESIZE
*
8
);
init_get_bits
(
&
gb
,
buf
,
FRAMESIZE
*
8
);
for
(
i
=
0
;
i
<
LPC_ORDER
;
i
++
)
for
(
i
=
0
;
i
<
LPC_ORDER
;
i
++
)
...
...
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