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
2c1ba799
Commit
2c1ba799
authored
Sep 26, 2011
by
Laurent Aimar
Committed by
Janne Grunau
Oct 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmapro: Validate the number of audio channels before using it
Signed-off-by:
Janne Grunau
<
janne-libav@jannau.net
>
parent
1e3336de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
wmaprodec.c
libavcodec/wmaprodec.c
+12
-12
No files found.
libavcodec/wmaprodec.c
View file @
2c1ba799
...
...
@@ -309,10 +309,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
s
->
samples_per_frame
=
1
<<
ff_wma_get_frame_len_bits
(
avctx
->
sample_rate
,
3
,
s
->
decode_flags
);
/** init previous block len */
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
s
->
channel
[
i
].
prev_block_len
=
s
->
samples_per_frame
;
/** subframe info */
log2_max_num_subframes
=
((
s
->
decode_flags
&
0x38
)
>>
3
);
s
->
max_num_subframes
=
1
<<
log2_max_num_subframes
;
...
...
@@ -332,6 +328,18 @@ static av_cold int decode_init(AVCodecContext *avctx)
s
->
num_channels
=
avctx
->
channels
;
if
(
s
->
num_channels
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid number of channels %d
\n
"
,
s
->
num_channels
);
return
AVERROR_INVALIDDATA
;
}
else
if
(
s
->
num_channels
>
WMAPRO_MAX_CHANNELS
)
{
av_log_ask_for_sample
(
avctx
,
"unsupported number of channels
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
/** init previous block len */
for
(
i
=
0
;
i
<
s
->
num_channels
;
i
++
)
s
->
channel
[
i
].
prev_block_len
=
s
->
samples_per_frame
;
/** extract lfe channel position */
s
->
lfe_channel
=
-
1
;
...
...
@@ -343,14 +351,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
}
if
(
s
->
num_channels
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid number of channels %d
\n
"
,
s
->
num_channels
);
return
AVERROR_INVALIDDATA
;
}
else
if
(
s
->
num_channels
>
WMAPRO_MAX_CHANNELS
)
{
av_log_ask_for_sample
(
avctx
,
"unsupported number of channels
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
INIT_VLC_STATIC
(
&
sf_vlc
,
SCALEVLCBITS
,
HUFF_SCALE_SIZE
,
scale_huffbits
,
1
,
1
,
scale_huffcodes
,
2
,
2
,
616
);
...
...
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