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
f1901180
Commit
f1901180
authored
Sep 29, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcmdec: fix output buffer size check by calculating the actual output size
prior to decoding.
parent
154cd253
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
pcm.c
libavcodec/pcm.c
+11
-4
No files found.
libavcodec/pcm.c
View file @
f1901180
...
...
@@ -250,7 +250,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
const
uint8_t
*
src
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
PCMDecode
*
s
=
avctx
->
priv_data
;
int
sample_size
,
c
,
n
;
int
sample_size
,
c
,
n
,
out_size
;
uint8_t
*
samples
;
int32_t
*
dst_int32_t
;
...
...
@@ -286,10 +286,17 @@ static int pcm_decode_frame(AVCodecContext *avctx,
buf_size
-=
buf_size
%
n
;
}
buf_size
=
FFMIN
(
buf_size
,
*
data_size
/
2
);
n
=
buf_size
/
sample_size
;
out_size
=
n
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
if
(
avctx
->
codec_id
==
CODEC_ID_PCM_DVD
||
avctx
->
codec_id
==
CODEC_ID_PCM_LXF
)
out_size
*=
2
;
if
(
*
data_size
<
out_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"output buffer too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
switch
(
avctx
->
codec
->
id
)
{
case
CODEC_ID_PCM_U32LE
:
DECODE
(
32
,
le32
,
src
,
samples
,
n
,
0
,
0x80000000
)
...
...
@@ -450,7 +457,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
default:
return
-
1
;
}
*
data_size
=
samples
-
(
uint8_t
*
)
data
;
*
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