libavcodec/qdm2.c:771: error: Buffer Overrun L2
  Offset: [0, 30] Size: 30 by call to `fix_coding_method_array`.

libavcodec/qdm2.c:770:14: Assignment
768.                     coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff;
769.                 }
770.         for (sb = 0; sb < 30; sb++)
                  ^
771.             fix_coding_method_array(sb, nb_channels, coding_method);
772.         for (ch = 0; ch < nb_channels; ch++)

libavcodec/qdm2.c:771:13: Call
769.                 }
770.         for (sb = 0; sb < 30; sb++)
771.             fix_coding_method_array(sb, nb_channels, coding_method);
                 ^
772.         for (ch = 0; ch < nb_channels; ch++)
773.             for (sb = 0; sb < 30; sb++)

libavcodec/qdm2.c:526:1: <Offset trace>
524.  * @param coding_method    q->coding_method[0][0][0]
525.  */
526. static int fix_coding_method_array(int sb, int channels,
     ^
527.                                    sb_int8_array coding_method)
528. {

libavcodec/qdm2.c:526:1: Parameter `sb`
  524.  * @param coding_method    q->coding_method[0][0][0]
  525.  */
  526. static int fix_coding_method_array(int sb, int channels,
       ^
  527.                                    sb_int8_array coding_method)
  528. {

libavcodec/qdm2.c:526:1: <Length trace>
524.  * @param coding_method    q->coding_method[0][0][0]
525.  */
526. static int fix_coding_method_array(int sb, int channels,
     ^
527.                                    sb_int8_array coding_method)
528. {

libavcodec/qdm2.c:526:1: Parameter `(*coding_method)[*]`
  524.  * @param coding_method    q->coding_method[0][0][0]
  525.  */
  526. static int fix_coding_method_array(int sb, int channels,
       ^
  527.                                    sb_int8_array coding_method)
  528. {

libavcodec/qdm2.c:567:25: Array access: Offset: [0, 30] Size: 30 by call to `fix_coding_method_array` 
  565.             for (k = 0; k < run; k++) {
  566.                 if (j + k < 128) {
  567.                     if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > coding_method[ch][sb][j]) {
                               ^
  568.                         if (k > 0) {
  569.                             SAMPLES_NEEDED

static int fix_coding_method_array(int sb, int channels,
                                   sb_int8_array coding_method)
{
    int j, k;
    int ch;
    int run, case_val;
    for (ch = 0; ch < channels; ch++) {
        for (j = 0; j < 64; ) {
            if (coding_method[ch][sb][j] < 8)
                return -1;
            if ((coding_method[ch][sb][j] - 8) > 22) {
                run      = 1;
                case_val = 8;
            } else {
                switch (switchtable[coding_method[ch][sb][j] - 8]) {
                case 0: run  = 10;
                    case_val = 10;
                    break;
                case 1: run  = 1;
                    case_val = 16;
                    break;
                case 2: run  = 5;
                    case_val = 24;
                    break;
                case 3: run  = 3;
                    case_val = 30;
                    break;
                case 4: run  = 1;
                    case_val = 30;
                    break;
                case 5: run  = 1;
                    case_val = 8;
                    break;
                default: run = 1;
                    case_val = 8;
                    break;
                }
            }
            for (k = 0; k < run; k++) {
                if (j + k < 128) {
                    if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > coding_method[ch][sb][j]) {
                        if (k > 0) {
                            SAMPLES_NEEDED
                            memset(&coding_method[ch][sb][j + k], case_val,
                                   k *sizeof(int8_t));
                            memset(&coding_method[ch][sb][j + k], case_val,
                                   3 * sizeof(int8_t));
                        }
                    }
                }
            }
            j += run;
        }
    }
    return 0;
}
['static void fill_coding_method_array(sb_int8_array tone_level_idx,\n                                     sb_int8_array tone_level_idx_temp,\n                                     sb_int8_array coding_method,\n                                     int nb_channels,\n                                     int c, int superblocktype_2_3,\n                                     int cm_table_select)\n{\n    int ch, sb, j;\n    int tmp, acc, esp_40, comp;\n    int add1, add2, add3, add4;\n    int64_t multres;\n    if (!superblocktype_2_3) {\n        SAMPLES_NEEDED\n        for (ch = 0; ch < nb_channels; ch++)\n            for (sb = 0; sb < 30; sb++) {\n                for (j = 1; j < 63; j++) {\n                    add1 = tone_level_idx[ch][sb][j] - 10;\n                    if (add1 < 0)\n                        add1 = 0;\n                    add2 = add3 = add4 = 0;\n                    if (sb > 1) {\n                        add2 = tone_level_idx[ch][sb - 2][j] + tone_level_idx_offset_table[sb][0] - 6;\n                        if (add2 < 0)\n                            add2 = 0;\n                    }\n                    if (sb > 0) {\n                        add3 = tone_level_idx[ch][sb - 1][j] + tone_level_idx_offset_table[sb][1] - 6;\n                        if (add3 < 0)\n                            add3 = 0;\n                    }\n                    if (sb < 29) {\n                        add4 = tone_level_idx[ch][sb + 1][j] + tone_level_idx_offset_table[sb][3] - 6;\n                        if (add4 < 0)\n                            add4 = 0;\n                    }\n                    tmp = tone_level_idx[ch][sb][j + 1] * 2 - add4 - add3 - add2 - add1;\n                    if (tmp < 0)\n                        tmp = 0;\n                    tone_level_idx_temp[ch][sb][j + 1] = tmp & 0xff;\n                }\n                tone_level_idx_temp[ch][sb][0] = tone_level_idx_temp[ch][sb][1];\n            }\n        acc = 0;\n        for (ch = 0; ch < nb_channels; ch++)\n            for (sb = 0; sb < 30; sb++)\n                for (j = 0; j < 64; j++)\n                    acc += tone_level_idx_temp[ch][sb][j];\n        multres = 0x66666667LL * (acc * 10);\n        esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31);\n        for (ch = 0;  ch < nb_channels; ch++)\n            for (sb = 0; sb < 30; sb++)\n                for (j = 0; j < 64; j++) {\n                    comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10;\n                    if (comp < 0)\n                        comp += 0xff;\n                    comp /= 256;\n                    switch(sb) {\n                        case 0:\n                            if (comp < 30)\n                                comp = 30;\n                            comp += 15;\n                            break;\n                        case 1:\n                            if (comp < 24)\n                                comp = 24;\n                            comp += 10;\n                            break;\n                        case 2:\n                        case 3:\n                        case 4:\n                            if (comp < 16)\n                                comp = 16;\n                    }\n                    if (comp <= 5)\n                        tmp = 0;\n                    else if (comp <= 10)\n                        tmp = 10;\n                    else if (comp <= 16)\n                        tmp = 16;\n                    else if (comp <= 24)\n                        tmp = -1;\n                    else\n                        tmp = 0;\n                    coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff;\n                }\n        for (sb = 0; sb < 30; sb++)\n            fix_coding_method_array(sb, nb_channels, coding_method);\n        for (ch = 0; ch < nb_channels; ch++)\n            for (sb = 0; sb < 30; sb++)\n                for (j = 0; j < 64; j++)\n                    if (sb >= 10) {\n                        if (coding_method[ch][sb][j] < 10)\n                            coding_method[ch][sb][j] = 10;\n                    } else {\n                        if (sb >= 2) {\n                            if (coding_method[ch][sb][j] < 16)\n                                coding_method[ch][sb][j] = 16;\n                        } else {\n                            if (coding_method[ch][sb][j] < 30)\n                                coding_method[ch][sb][j] = 30;\n                        }\n                    }\n    } else {\n        for (ch = 0; ch < nb_channels; ch++)\n            for (sb = 0; sb < 30; sb++)\n                for (j = 0; j < 64; j++)\n                    coding_method[ch][sb][j] = coding_method_table[cm_table_select][sb];\n    }\n}', 'static int fix_coding_method_array(int sb, int channels,\n                                   sb_int8_array coding_method)\n{\n    int j, k;\n    int ch;\n    int run, case_val;\n    for (ch = 0; ch < channels; ch++) {\n        for (j = 0; j < 64; ) {\n            if (coding_method[ch][sb][j] < 8)\n                return -1;\n            if ((coding_method[ch][sb][j] - 8) > 22) {\n                run      = 1;\n                case_val = 8;\n            } else {\n                switch (switchtable[coding_method[ch][sb][j] - 8]) {\n                case 0: run  = 10;\n                    case_val = 10;\n                    break;\n                case 1: run  = 1;\n                    case_val = 16;\n                    break;\n                case 2: run  = 5;\n                    case_val = 24;\n                    break;\n                case 3: run  = 3;\n                    case_val = 30;\n                    break;\n                case 4: run  = 1;\n                    case_val = 30;\n                    break;\n                case 5: run  = 1;\n                    case_val = 8;\n                    break;\n                default: run = 1;\n                    case_val = 8;\n                    break;\n                }\n            }\n            for (k = 0; k < run; k++) {\n                if (j + k < 128) {\n                    if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > coding_method[ch][sb][j]) {\n                        if (k > 0) {\n                            SAMPLES_NEEDED\n                            memset(&coding_method[ch][sb][j + k], case_val,\n                                   k *sizeof(int8_t));\n                            memset(&coding_method[ch][sb][j + k], case_val,\n                                   3 * sizeof(int8_t));\n                        }\n                    }\n                }\n            }\n            j += run;\n        }\n    }\n    return 0;\n}']