comparison mpegaudiodec.c @ 4202:af24e0fd0d1b libavcodec

more checks and error messages
author michael
date Tue, 14 Nov 2006 20:35:15 +0000
parents 04ff8026d9c0
children 14250f6ff483
comparison
equal deleted inserted replaced
4201:c4f87cfd5b20 4202:af24e0fd0d1b
2164 for(ch=0;ch<s->nb_channels;ch++) { 2164 for(ch=0;ch<s->nb_channels;ch++) {
2165 dprintf("gr=%d ch=%d: side_info\n", gr, ch); 2165 dprintf("gr=%d ch=%d: side_info\n", gr, ch);
2166 g = &granules[ch][gr]; 2166 g = &granules[ch][gr];
2167 g->part2_3_length = get_bits(&s->gb, 12); 2167 g->part2_3_length = get_bits(&s->gb, 12);
2168 g->big_values = get_bits(&s->gb, 9); 2168 g->big_values = get_bits(&s->gb, 9);
2169 if(g->big_values > 288){
2170 av_log(NULL, AV_LOG_ERROR, "big_values too big\n");
2171 return -1;
2172 }
2173
2169 g->global_gain = get_bits(&s->gb, 8); 2174 g->global_gain = get_bits(&s->gb, 8);
2170 /* if MS stereo only is selected, we precompute the 2175 /* if MS stereo only is selected, we precompute the
2171 1/sqrt(2) renormalization factor */ 2176 1/sqrt(2) renormalization factor */
2172 if ((s->mode_ext & (MODE_EXT_MS_STEREO | MODE_EXT_I_STEREO)) == 2177 if ((s->mode_ext & (MODE_EXT_MS_STEREO | MODE_EXT_I_STEREO)) ==
2173 MODE_EXT_MS_STEREO) 2178 MODE_EXT_MS_STEREO)
2177 else 2182 else
2178 g->scalefac_compress = get_bits(&s->gb, 4); 2183 g->scalefac_compress = get_bits(&s->gb, 4);
2179 blocksplit_flag = get_bits(&s->gb, 1); 2184 blocksplit_flag = get_bits(&s->gb, 1);
2180 if (blocksplit_flag) { 2185 if (blocksplit_flag) {
2181 g->block_type = get_bits(&s->gb, 2); 2186 g->block_type = get_bits(&s->gb, 2);
2182 if (g->block_type == 0) 2187 if (g->block_type == 0){
2188 av_log(NULL, AV_LOG_ERROR, "invalid block type\n");
2183 return -1; 2189 return -1;
2190 }
2184 g->switch_point = get_bits(&s->gb, 1); 2191 g->switch_point = get_bits(&s->gb, 1);
2185 for(i=0;i<2;i++) 2192 for(i=0;i<2;i++)
2186 g->table_select[i] = get_bits(&s->gb, 5); 2193 g->table_select[i] = get_bits(&s->gb, 5);
2187 for(i=0;i<3;i++) 2194 for(i=0;i<3;i++)
2188 g->subblock_gain[i] = get_bits(&s->gb, 3); 2195 g->subblock_gain[i] = get_bits(&s->gb, 3);