Mercurial > libavcodec.hg
comparison aacsbr.c @ 11434:c969ceeffb36 libavcodec
aacsbr: Fail early on illegal envelope counts.
author | alexc |
---|---|
date | Tue, 09 Mar 2010 10:25:42 +0000 |
parents | d8c2170062ce |
children | 4dfd0bfbb8dc |
comparison
equal
deleted
inserted
replaced
11433:d8c2170062ce | 11434:c969ceeffb36 |
---|---|
626 case FIXFIX: | 626 case FIXFIX: |
627 ch_data->bs_num_env[1] = 1 << get_bits(gb, 2); | 627 ch_data->bs_num_env[1] = 1 << get_bits(gb, 2); |
628 if (ch_data->bs_num_env[1] == 1) | 628 if (ch_data->bs_num_env[1] == 1) |
629 ch_data->bs_amp_res = 0; | 629 ch_data->bs_amp_res = 0; |
630 | 630 |
631 if (ch_data->bs_num_env[1] > 4) { | |
632 av_log(ac->avccontext, AV_LOG_ERROR, | |
633 "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", | |
634 ch_data->bs_num_env[1]); | |
635 return -1; | |
636 } | |
637 | |
631 ch_data->bs_pointer = 0; | 638 ch_data->bs_pointer = 0; |
632 | 639 |
633 ch_data->bs_freq_res[1] = get_bits1(gb); | 640 ch_data->bs_freq_res[1] = get_bits1(gb); |
634 for (i = 1; i < ch_data->bs_num_env[1]; i++) | 641 for (i = 1; i < ch_data->bs_num_env[1]; i++) |
635 ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1]; | 642 ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1]; |
664 ch_data->bs_var_bord[1] = get_bits(gb, 2); | 671 ch_data->bs_var_bord[1] = get_bits(gb, 2); |
665 ch_data->bs_num_rel[0] = get_bits(gb, 2); | 672 ch_data->bs_num_rel[0] = get_bits(gb, 2); |
666 ch_data->bs_num_rel[1] = get_bits(gb, 2); | 673 ch_data->bs_num_rel[1] = get_bits(gb, 2); |
667 ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + ch_data->bs_num_rel[1] + 1; | 674 ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + ch_data->bs_num_rel[1] + 1; |
668 | 675 |
676 if (ch_data->bs_num_env[1] > 5) { | |
677 av_log(ac->avccontext, AV_LOG_ERROR, | |
678 "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", | |
679 ch_data->bs_num_env[1]); | |
680 return -1; | |
681 } | |
682 | |
669 for (i = 0; i < ch_data->bs_num_rel[0]; i++) | 683 for (i = 0; i < ch_data->bs_num_rel[0]; i++) |
670 ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; | 684 ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; |
671 for (i = 0; i < ch_data->bs_num_rel[1]; i++) | 685 for (i = 0; i < ch_data->bs_num_rel[1]; i++) |
672 ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; | 686 ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; |
673 | 687 |
679 | 693 |
680 if (ch_data->bs_pointer > ch_data->bs_num_env[1] + 1) { | 694 if (ch_data->bs_pointer > ch_data->bs_num_env[1] + 1) { |
681 av_log(ac->avccontext, AV_LOG_ERROR, | 695 av_log(ac->avccontext, AV_LOG_ERROR, |
682 "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", | 696 "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", |
683 ch_data->bs_pointer); | 697 ch_data->bs_pointer); |
684 return -1; | |
685 } | |
686 if (ch_data->bs_frame_class == FIXFIX && ch_data->bs_num_env[1] > 4) { | |
687 av_log(ac->avccontext, AV_LOG_ERROR, | |
688 "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", | |
689 ch_data->bs_num_env[1]); | |
690 return -1; | |
691 } | |
692 if (ch_data->bs_frame_class == VARVAR && ch_data->bs_num_env[1] > 5) { | |
693 av_log(ac->avccontext, AV_LOG_ERROR, | |
694 "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", | |
695 ch_data->bs_num_env[1]); | |
696 return -1; | 698 return -1; |
697 } | 699 } |
698 | 700 |
699 ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1; | 701 ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1; |
700 | 702 |