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

libavcodec/qdm2.c:759:18: Assignment
757.                         coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff;
758.                     }
759.             for (sb = 0; sb < 30; sb++)
                      ^
760.                 fix_coding_method_array(sb, nb_channels, coding_method);
761.             for (ch = 0; ch < nb_channels; ch++)

libavcodec/qdm2.c:760:17: Call
758.                     }
759.             for (sb = 0; sb < 30; sb++)
760.                 fix_coding_method_array(sb, nb_channels, coding_method);
                     ^
761.             for (ch = 0; ch < nb_channels; ch++)
762.                 for (sb = 0; sb < 30; sb++)

libavcodec/qdm2.c:529:1: <Offset trace>
527.  * @param coding_method    q->coding_method[0][0][0]
528.  */
529. static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
     ^
530. {
531.     int j,k;

libavcodec/qdm2.c:529:1: Parameter `sb`
  527.  * @param coding_method    q->coding_method[0][0][0]
  528.  */
  529. static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
       ^
  530. {
  531.     int j,k;

libavcodec/qdm2.c:529:1: <Length trace>
527.  * @param coding_method    q->coding_method[0][0][0]
528.  */
529. static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
     ^
530. {
531.     int j,k;

libavcodec/qdm2.c:529:1: Parameter `(*coding_method)[*]`
  527.  * @param coding_method    q->coding_method[0][0][0]
  528.  */
  529. static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
       ^
  530. {
  531.     int j,k;

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

static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
{
    int j,k;
    int ch;
    int run, case_val;
    int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
    for (ch = 0; ch < channels; ch++) {
        for (j = 0; j < 64; ) {
            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;
        }
    }
}
['static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp,\n                sb_int8_array coding_method, int nb_channels,\n                int c, int superblocktype_2_3, 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 (nb_channels <= 0)\n        return;\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 < 64; 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            if (acc)\n                tmp = c * 256 / (acc & 0xffff);\n            multres = 0x66666667 * (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    return;\n}', 'static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)\n{\n    int j,k;\n    int ch;\n    int run, case_val;\n    int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};\n    for (ch = 0; ch < channels; ch++) {\n        for (j = 0; j < 64; ) {\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; case_val = 10; break;\n                    case 1: run = 1; case_val = 16; break;\n                    case 2: run = 5; case_val = 24; break;\n                    case 3: run = 3; case_val = 30; break;\n                    case 4: run = 1; case_val = 30; break;\n                    case 5: run = 1; case_val = 8; break;\n                    default: run = 1; case_val = 8; 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, k * sizeof(int8_t));\n                            memset(&coding_method[ch][sb][j + k], case_val, 3 * sizeof(int8_t));\n                        }\n            j += run;\n        }\n    }\n}']