libavcodec/mpegaudiodec.c:1316: error: Buffer Overrun L2
  Offset: [0, 3] Size: 3 by call to `l2_unscale_group`.

libavcodec/mpegaudiodec.c:1316:33: Call
1314.                             v = v / steps;
1315.                             s->sb_samples[ch][k * 12 + l + 1][i] =
1316.                                 l2_unscale_group(steps, v % steps, scale);
                                      ^
1317.                             v = v / steps;
1318.                             s->sb_samples[ch][k * 12 + l + 2][i] =

libavcodec/mpegaudiodec.c:207:1: <Offset trace>
205. }
206. 
207. static inline int l2_unscale_group(int steps, int mant, int scale_factor)
     ^
208. {
209.     int shift, mod, val;

libavcodec/mpegaudiodec.c:207:1: Global `scale_factor_modshift`
  205. }
  206. 
  207. static inline int l2_unscale_group(int steps, int mant, int scale_factor)
       ^
  208. {
  209.     int shift, mod, val;

libavcodec/mpegaudiodec.c:211:5: Assignment
  209.     int shift, mod, val;
  210. 
  211.     shift = scale_factor_modshift[scale_factor];
           ^
  212.     mod = shift & 3;
  213.     shift >>= 2;

libavcodec/mpegaudiodec.c:212:5: Assignment
  210. 
  211.     shift = scale_factor_modshift[scale_factor];
  212.     mod = shift & 3;
           ^
  213.     shift >>= 2;
  214. 

libavcodec/mpegaudiodec.c:121:1: <Length trace>
119. { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) }
120. 
121. static const int32_t scale_factor_mult2[3][3] = {
     ^
122.     SCALE_GEN(4.0 / 3.0), /* 3 steps */
123.     SCALE_GEN(4.0 / 5.0), /* 5 steps */

libavcodec/mpegaudiodec.c:121:1: Array declaration
  119. { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) }
  120. 
  121. static const int32_t scale_factor_mult2[3][3] = {
       ^
  122.     SCALE_GEN(4.0 / 3.0), /* 3 steps */
  123.     SCALE_GEN(4.0 / 5.0), /* 5 steps */

libavcodec/mpegaudiodec.c:215:35: Array access: Offset: [0, 3] Size: 3 by call to `l2_unscale_group` 
  213.     shift >>= 2;
  214. 
  215.     val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod];
                                         ^
  216.     /* NOTE: at this point, 0 <= shift <= 21 */
  217.     if (shift > 0)

static inline int l2_unscale_group(int steps, int mant, int scale_factor)
{
    int shift, mod, val;
    shift = scale_factor_modshift[scale_factor];
    mod = shift & 3;
    shift >>= 2;
    val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod];
    if (shift > 0)
        val = (val + (1 << (shift - 1))) >> shift;
    return val;
}
['static int mp_decode_layer2(MPADecodeContext *s)\n{\n    int sblimit;\n    const unsigned char *alloc_table;\n    int table, bit_alloc_bits, i, j, ch, bound, v;\n    unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];\n    unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];\n    unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3], *sf;\n    int scale, qindex, bits, steps, k, l, m, b;\n    table = ff_mpa_l2_select_table(s->bit_rate / 1000, s->nb_channels,\n                            s->sample_rate, s->lsf);\n    sblimit = ff_mpa_sblimit_table[table];\n    alloc_table = ff_mpa_alloc_tables[table];\n    if (s->mode == MPA_JSTEREO)\n        bound = (s->mode_ext + 1) * 4;\n    else\n        bound = sblimit;\n    dprintf(s->avctx, "bound=%d sblimit=%d\\n", bound, sblimit);\n    if( bound > sblimit ) bound = sblimit;\n    j = 0;\n    for(i=0;i<bound;i++) {\n        bit_alloc_bits = alloc_table[j];\n        for(ch=0;ch<s->nb_channels;ch++) {\n            bit_alloc[ch][i] = get_bits(&s->gb, bit_alloc_bits);\n        }\n        j += 1 << bit_alloc_bits;\n    }\n    for(i=bound;i<sblimit;i++) {\n        bit_alloc_bits = alloc_table[j];\n        v = get_bits(&s->gb, bit_alloc_bits);\n        bit_alloc[0][i] = v;\n        bit_alloc[1][i] = v;\n        j += 1 << bit_alloc_bits;\n    }\n#ifdef DEBUG\n    {\n        for(ch=0;ch<s->nb_channels;ch++) {\n            for(i=0;i<sblimit;i++)\n                dprintf(s->avctx, " %d", bit_alloc[ch][i]);\n            dprintf(s->avctx, "\\n");\n        }\n    }\n#endif\n    for(i=0;i<sblimit;i++) {\n        for(ch=0;ch<s->nb_channels;ch++) {\n            if (bit_alloc[ch][i])\n                scale_code[ch][i] = get_bits(&s->gb, 2);\n        }\n    }\n    for(i=0;i<sblimit;i++) {\n        for(ch=0;ch<s->nb_channels;ch++) {\n            if (bit_alloc[ch][i]) {\n                sf = scale_factors[ch][i];\n                switch(scale_code[ch][i]) {\n                default:\n                case 0:\n                    sf[0] = get_bits(&s->gb, 6);\n                    sf[1] = get_bits(&s->gb, 6);\n                    sf[2] = get_bits(&s->gb, 6);\n                    break;\n                case 2:\n                    sf[0] = get_bits(&s->gb, 6);\n                    sf[1] = sf[0];\n                    sf[2] = sf[0];\n                    break;\n                case 1:\n                    sf[0] = get_bits(&s->gb, 6);\n                    sf[2] = get_bits(&s->gb, 6);\n                    sf[1] = sf[0];\n                    break;\n                case 3:\n                    sf[0] = get_bits(&s->gb, 6);\n                    sf[2] = get_bits(&s->gb, 6);\n                    sf[1] = sf[2];\n                    break;\n                }\n            }\n        }\n    }\n#ifdef DEBUG\n    for(ch=0;ch<s->nb_channels;ch++) {\n        for(i=0;i<sblimit;i++) {\n            if (bit_alloc[ch][i]) {\n                sf = scale_factors[ch][i];\n                dprintf(s->avctx, " %d %d %d", sf[0], sf[1], sf[2]);\n            } else {\n                dprintf(s->avctx, " -");\n            }\n        }\n        dprintf(s->avctx, "\\n");\n    }\n#endif\n    for(k=0;k<3;k++) {\n        for(l=0;l<12;l+=3) {\n            j = 0;\n            for(i=0;i<bound;i++) {\n                bit_alloc_bits = alloc_table[j];\n                for(ch=0;ch<s->nb_channels;ch++) {\n                    b = bit_alloc[ch][i];\n                    if (b) {\n                        scale = scale_factors[ch][i][k];\n                        qindex = alloc_table[j+b];\n                        bits = ff_mpa_quant_bits[qindex];\n                        if (bits < 0) {\n                            v = get_bits(&s->gb, -bits);\n                            steps = ff_mpa_quant_steps[qindex];\n                            s->sb_samples[ch][k * 12 + l + 0][i] =\n                                l2_unscale_group(steps, v % steps, scale);\n                            v = v / steps;\n                            s->sb_samples[ch][k * 12 + l + 1][i] =\n                                l2_unscale_group(steps, v % steps, scale);\n                            v = v / steps;\n                            s->sb_samples[ch][k * 12 + l + 2][i] =\n                                l2_unscale_group(steps, v, scale);\n                        } else {\n                            for(m=0;m<3;m++) {\n                                v = get_bits(&s->gb, bits);\n                                v = l1_unscale(bits - 1, v, scale);\n                                s->sb_samples[ch][k * 12 + l + m][i] = v;\n                            }\n                        }\n                    } else {\n                        s->sb_samples[ch][k * 12 + l + 0][i] = 0;\n                        s->sb_samples[ch][k * 12 + l + 1][i] = 0;\n                        s->sb_samples[ch][k * 12 + l + 2][i] = 0;\n                    }\n                }\n                j += 1 << bit_alloc_bits;\n            }\n            for(i=bound;i<sblimit;i++) {\n                bit_alloc_bits = alloc_table[j];\n                b = bit_alloc[0][i];\n                if (b) {\n                    int mant, scale0, scale1;\n                    scale0 = scale_factors[0][i][k];\n                    scale1 = scale_factors[1][i][k];\n                    qindex = alloc_table[j+b];\n                    bits = ff_mpa_quant_bits[qindex];\n                    if (bits < 0) {\n                        v = get_bits(&s->gb, -bits);\n                        steps = ff_mpa_quant_steps[qindex];\n                        mant = v % steps;\n                        v = v / steps;\n                        s->sb_samples[0][k * 12 + l + 0][i] =\n                            l2_unscale_group(steps, mant, scale0);\n                        s->sb_samples[1][k * 12 + l + 0][i] =\n                            l2_unscale_group(steps, mant, scale1);\n                        mant = v % steps;\n                        v = v / steps;\n                        s->sb_samples[0][k * 12 + l + 1][i] =\n                            l2_unscale_group(steps, mant, scale0);\n                        s->sb_samples[1][k * 12 + l + 1][i] =\n                            l2_unscale_group(steps, mant, scale1);\n                        s->sb_samples[0][k * 12 + l + 2][i] =\n                            l2_unscale_group(steps, v, scale0);\n                        s->sb_samples[1][k * 12 + l + 2][i] =\n                            l2_unscale_group(steps, v, scale1);\n                    } else {\n                        for(m=0;m<3;m++) {\n                            mant = get_bits(&s->gb, bits);\n                            s->sb_samples[0][k * 12 + l + m][i] =\n                                l1_unscale(bits - 1, mant, scale0);\n                            s->sb_samples[1][k * 12 + l + m][i] =\n                                l1_unscale(bits - 1, mant, scale1);\n                        }\n                    }\n                } else {\n                    s->sb_samples[0][k * 12 + l + 0][i] = 0;\n                    s->sb_samples[0][k * 12 + l + 1][i] = 0;\n                    s->sb_samples[0][k * 12 + l + 2][i] = 0;\n                    s->sb_samples[1][k * 12 + l + 0][i] = 0;\n                    s->sb_samples[1][k * 12 + l + 1][i] = 0;\n                    s->sb_samples[1][k * 12 + l + 2][i] = 0;\n                }\n                j += 1 << bit_alloc_bits;\n            }\n            for(i=sblimit;i<SBLIMIT;i++) {\n                for(ch=0;ch<s->nb_channels;ch++) {\n                    s->sb_samples[ch][k * 12 + l + 0][i] = 0;\n                    s->sb_samples[ch][k * 12 + l + 1][i] = 0;\n                    s->sb_samples[ch][k * 12 + l + 2][i] = 0;\n                }\n            }\n        }\n    }\n    return 3 * 12;\n}', 'static inline int l2_unscale_group(int steps, int mant, int scale_factor)\n{\n    int shift, mod, val;\n    shift = scale_factor_modshift[scale_factor];\n    mod = shift & 3;\n    shift >>= 2;\n    val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod];\n    if (shift > 0)\n        val = (val + (1 << (shift - 1))) >> shift;\n    return val;\n}']