comparison qdm2.c @ 7326:fe8a7f5905e4 libavcodec

Prevent the qdm2 code from overreading/overflowing. Fixes Coverity ID 112 run 2
author banan
date Sat, 19 Jul 2008 18:53:04 +0000
parents 5d6c51a125d0
children 85ab7655ad4d
comparison
equal deleted inserted replaced
7325:af725308adf4 7326:fe8a7f5905e4
682 if (!superblocktype_2_3) { 682 if (!superblocktype_2_3) {
683 /* This case is untested, no samples available */ 683 /* This case is untested, no samples available */
684 SAMPLES_NEEDED 684 SAMPLES_NEEDED
685 for (ch = 0; ch < nb_channels; ch++) 685 for (ch = 0; ch < nb_channels; ch++)
686 for (sb = 0; sb < 30; sb++) { 686 for (sb = 0; sb < 30; sb++) {
687 for (j = 1; j < 64; j++) { 687 for (j = 1; j < 63; j++) { // The loop only iterates to 63 so the code doesn't overflow the buffer
688 add1 = tone_level_idx[ch][sb][j] - 10; 688 add1 = tone_level_idx[ch][sb][j] - 10;
689 if (add1 < 0) 689 if (add1 < 0)
690 add1 = 0; 690 add1 = 0;
691 add2 = add3 = add4 = 0; 691 add2 = add3 = add4 = 0;
692 if (sb > 1) { 692 if (sb > 1) {