comparison mpeg12.c @ 1809:45a7f6690782 libavcodec

more error checks for the sequence header
author michael
date Mon, 16 Feb 2004 03:34:11 +0000
parents 95612d423fde
children 1adbe0ab09fc
comparison
equal deleted inserted replaced
1808:9d860b33fd54 1809:45a7f6690782
2371 2371
2372 /* get matrix */ 2372 /* get matrix */
2373 if (get_bits1(&s->gb)) { 2373 if (get_bits1(&s->gb)) {
2374 for(i=0;i<64;i++) { 2374 for(i=0;i<64;i++) {
2375 v = get_bits(&s->gb, 8); 2375 v = get_bits(&s->gb, 8);
2376 if(v==0){
2377 av_log(s->avctx, AV_LOG_ERROR, "intra matrix damaged\n");
2378 return -1;
2379 }
2376 j = s->intra_scantable.permutated[i]; 2380 j = s->intra_scantable.permutated[i];
2377 s->intra_matrix[j] = v; 2381 s->intra_matrix[j] = v;
2378 s->chroma_intra_matrix[j] = v; 2382 s->chroma_intra_matrix[j] = v;
2379 } 2383 }
2380 #ifdef DEBUG 2384 #ifdef DEBUG
2392 } 2396 }
2393 } 2397 }
2394 if (get_bits1(&s->gb)) { 2398 if (get_bits1(&s->gb)) {
2395 for(i=0;i<64;i++) { 2399 for(i=0;i<64;i++) {
2396 v = get_bits(&s->gb, 8); 2400 v = get_bits(&s->gb, 8);
2401 if(v==0){
2402 av_log(s->avctx, AV_LOG_ERROR, "inter matrix damaged\n");
2403 return -1;
2404 }
2397 j = s->intra_scantable.permutated[i]; 2405 j = s->intra_scantable.permutated[i];
2398 s->inter_matrix[j] = v; 2406 s->inter_matrix[j] = v;
2399 s->chroma_inter_matrix[j] = v; 2407 s->chroma_inter_matrix[j] = v;
2400 } 2408 }
2401 #ifdef DEBUG 2409 #ifdef DEBUG
2409 int j= s->dsp.idct_permutation[i]; 2417 int j= s->dsp.idct_permutation[i];
2410 v = ff_mpeg1_default_non_intra_matrix[i]; 2418 v = ff_mpeg1_default_non_intra_matrix[i];
2411 s->inter_matrix[j] = v; 2419 s->inter_matrix[j] = v;
2412 s->chroma_inter_matrix[j] = v; 2420 s->chroma_inter_matrix[j] = v;
2413 } 2421 }
2422 }
2423
2424 if(show_bits(&s->gb, 23) != 0){
2425 av_log(s->avctx, AV_LOG_ERROR, "sequence header damaged\n");
2426 return -1;
2414 } 2427 }
2415 2428
2416 /* we set mpeg2 parameters so that it emulates mpeg1 */ 2429 /* we set mpeg2 parameters so that it emulates mpeg1 */
2417 s->progressive_sequence = 1; 2430 s->progressive_sequence = 1;
2418 s->progressive_frame = 1; 2431 s->progressive_frame = 1;