summaryrefslogtreecommitdiff
path: root/libavcodec/vorbisdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-03 19:20:54 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-03 23:44:47 +0100
commitb4b13848dec5420fa5dd9e1a7d4dfae5de1932d5 (patch)
tree2624bdef91dcaa8d02636efcd81f5938615d7516 /libavcodec/vorbisdec.c
parent0a451082c774540f8d47642d2078fcf2c822ebc1 (diff)
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: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/vorbisdec.c')
-rw-r--r--libavcodec/vorbisdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index f773afaa41..4dd47ac715 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -789,6 +789,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
if (get_bits1(gb)) {
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 *
sizeof(*mapping_setup->magnitude));
mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps *