Commit b4b13848 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

vorbisdec: reject channel mapping with less than two channels

It causes the angle channel number to equal the magnitude channel
number, which makes the stream undecodable according to the
specification.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 0a451082
...@@ -789,6 +789,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) ...@@ -789,6 +789,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
if (get_bits1(gb)) { if (get_bits1(gb)) {
mapping_setup->coupling_steps = get_bits(gb, 8) + 1; mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
if (vc->audio_channels < 2) {
av_log(vc->avctx, AV_LOG_ERROR,
"Square polar channel mapping with less than two channels is not compliant with the Vorbis I specification.\n");
return AVERROR_INVALIDDATA;
}
mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps * mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps *
sizeof(*mapping_setup->magnitude)); sizeof(*mapping_setup->magnitude));
mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps * mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment