comparison mlpdec.c @ 9283:a37db17a8283 libavcodec

mlpdec: More validation for read_channel_params()
author ramiro
date Mon, 30 Mar 2009 03:20:01 +0000
parents 2f82384bbe05
children 4072adff072e
comparison
equal deleted inserted replaced
9282:2f82384bbe05 9283:a37db17a8283
559 if (s->param_presence_flags & PARAM_IIR) 559 if (s->param_presence_flags & PARAM_IIR)
560 if (get_bits1(gbp)) 560 if (get_bits1(gbp))
561 if (read_filter_params(m, gbp, ch, IIR) < 0) 561 if (read_filter_params(m, gbp, ch, IIR) < 0)
562 return -1; 562 return -1;
563 563
564 if (fir->order + iir->order > 8) {
565 av_log(m->avctx, AV_LOG_ERROR, "Total filter orders too high.\n");
566 return -1;
567 }
568
564 if (fir->order && iir->order && 569 if (fir->order && iir->order &&
565 fir->shift != iir->shift) { 570 fir->shift != iir->shift) {
566 av_log(m->avctx, AV_LOG_ERROR, 571 av_log(m->avctx, AV_LOG_ERROR,
567 "FIR and IIR filters must use the same precision.\n"); 572 "FIR and IIR filters must use the same precision.\n");
568 return -1; 573 return -1;
580 cp->huff_offset = get_sbits(gbp, 15); 585 cp->huff_offset = get_sbits(gbp, 15);
581 586
582 cp->codebook = get_bits(gbp, 2); 587 cp->codebook = get_bits(gbp, 2);
583 cp->huff_lsbs = get_bits(gbp, 5); 588 cp->huff_lsbs = get_bits(gbp, 5);
584 589
590 if (cp->huff_lsbs > 24) {
591 av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n");
592 return -1;
593 }
594
585 cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); 595 cp->sign_huff_offset = calculate_sign_huff(m, substr, ch);
586
587 /* TODO: validate */
588 596
589 return 0; 597 return 0;
590 } 598 }
591 599
592 /** Read decoding parameters that change more often than those in the restart 600 /** Read decoding parameters that change more often than those in the restart