comparison dca.c @ 11304:3ef04d1190f0 libavcodec

Fixed a segfault in the DCA decoder with corrupted streams. It happens when the number of channels defined by DCAContext:acmod is lower than DCAContext:prim_channels. In this case, dca_subsubframe() will call qmf_32_subbands() using s->channel_order_tab[] entries equal to -1.
author fenrir
date Fri, 26 Feb 2010 18:50:01 +0000
parents 34a65026fa06
children 98970e51365a
comparison
equal deleted inserted replaced
11303:b0cb1f7efcbc 11304:3ef04d1190f0
1242 avctx->channel_layout |= CH_LOW_FREQUENCY; 1242 avctx->channel_layout |= CH_LOW_FREQUENCY;
1243 s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; 1243 s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
1244 } else 1244 } else
1245 s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; 1245 s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
1246 1246
1247 if (s->prim_channels > 0 &&
1248 s->channel_order_tab[s->prim_channels - 1] < 0)
1249 return -1;
1250
1247 if(avctx->request_channels == 2 && s->prim_channels > 2) { 1251 if(avctx->request_channels == 2 && s->prim_channels > 2) {
1248 channels = 2; 1252 channels = 2;
1249 s->output = DCA_STEREO; 1253 s->output = DCA_STEREO;
1250 avctx->channel_layout = CH_LAYOUT_STEREO; 1254 avctx->channel_layout = CH_LAYOUT_STEREO;
1251 } 1255 }