libavcodec/amrnbdec.c:1026: error: Buffer Overrun L2
  Offset: [21, 57] Size: 40 by call to `anti_sparseness`.

libavcodec/amrnbdec.c:975:9: Call
973.         const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
974. 
975.         decode_pitch_vector(p, amr_subframe, subframe);
             ^
976. 
977.         decode_fixed_sparse(&fixed_sparse, amr_subframe->pulses,

libavcodec/amrnbdec.c:385:9: Call
  383. 
  384.     if (p->cur_frame_mode == MODE_12k2) {
  385.         decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac,
               ^
  386.                              amr_subframe->p_lag, p->pitch_lag_int,
  387.                              subframe);

libavcodec/amrnbdec.c:358:1: Parameter `pitch_index`
    356.  * Like ff_decode_pitch_lag(), but with 1/6 resolution
    357.  */
    358. static void decode_pitch_lag_1_6(int *lag_int, int *lag_frac, int pitch_index,
         ^
    359.                                  const int prev_lag_int, const int subframe)
    360. {

libavcodec/amrnbdec.c:363:13: Assignment
    361.     if (subframe == 0 || subframe == 2) {
    362.         if (pitch_index < 463) {
    363.             *lag_int  = (pitch_index + 107) * 10923 >> 16;
                     ^
    364.             *lag_frac = pitch_index - *lag_int * 6 + 105;
    365.         } else {

libavcodec/amrnbdec.c:395:5: Assignment
  393.                             mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6));
  394. 
  395.     p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t
           ^
  396. 
  397.     pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2);

libavcodec/amrnbdec.c:987:9: Call
985.                      &fixed_gain_factor);
986. 
987.         pitch_sharpening(p, subframe, p->cur_frame_mode, &fixed_sparse);
             ^
988. 
989.         if (fixed_sparse.pitch_lag == 0) {

libavcodec/amrnbdec.c:537:1: Parameter `p->pitch_lag_int`
  535.  * @param fixed_sparse sparse representation of the fixed vector
  536.  */
  537. static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode,
       ^
  538.                              AMRFixed *fixed_sparse)
  539. {

libavcodec/amrnbdec.c:546:5: Assignment
  544.         p->beta = FFMIN(p->pitch_gain[4], 1.0);
  545. 
  546.     fixed_sparse->pitch_lag  = p->pitch_lag_int;
           ^
  547.     fixed_sparse->pitch_fac  = p->beta;
  548. 

libavcodec/amrnbdec.c:1026:30: Call
1024.                                              p->lsf_avg, p->cur_frame_mode);
1025. 
1026.         synth_fixed_vector = anti_sparseness(p, &fixed_sparse, p->fixed_vector,
                                   ^
1027.                                              synth_fixed_gain, spare_vector);
1028. 

libavcodec/amrnbdec.c:704:1: Parameter `fixed_sparse->pitch_lag`
  702.  * @param out space for modified vector if necessary
  703.  */
  704. static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse,
       ^
  705.                                     const float *fixed_vector,
  706.                                     float fixed_gain, float *out)

libavcodec/amrnbdec.c:745:9: Call
  743.     if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2
  744.          && ir_filter_nr < 2) {
  745.         apply_ir_filter(out, fixed_sparse,
               ^
  746.                         (p->cur_frame_mode == MODE_7k95 ?
  747.                              ir_filters_lookup_MODE_7k95 :

libavcodec/amrnbdec.c:657:1: Array declaration
    655.  *  out[n] = sum(i,0,len-1){ in[i] * filter[(len + n - i)%len] }
    656.  */
    657. static void apply_ir_filter(float *out, const AMRFixed *in,
         ^
    658.                             const float *filter)
    659. {

libavcodec/amrnbdec.c:671:13: Call
    669. 
    670.         if (lag < AMR_SUBFRAME_SIZE >> 1)
    671.             ff_celp_circ_addf(filter2, filter, filter1, lag, fac,
                     ^
    672.                               AMR_SUBFRAME_SIZE);
    673.     }

libavcodec/celp_filters.c:49:1: <Offset trace>
47. }
48. 
49. void ff_celp_circ_addf(float *out, const float *in,
    ^
50.                        const float *lagged, int lag, float fac, int n)
51. {

libavcodec/celp_filters.c:49:1: Parameter `lag`
      47. }
      48. 
      49. void ff_celp_circ_addf(float *out, const float *in,
          ^
      50.                        const float *lagged, int lag, float fac, int n)
      51. {

libavcodec/celp_filters.c:49:1: <Length trace>
47. }
48. 
49. void ff_celp_circ_addf(float *out, const float *in,
    ^
50.                        const float *lagged, int lag, float fac, int n)
51. {

libavcodec/celp_filters.c:49:1: Parameter `*lagged`
      47. }
      48. 
      49. void ff_celp_circ_addf(float *out, const float *in,
          ^
      50.                        const float *lagged, int lag, float fac, int n)
      51. {

libavcodec/celp_filters.c:54:32: Array access: Offset: [21, 57] Size: 40 by call to `anti_sparseness` 
      52.     int k;
      53.     for (k = 0; k < lag; k++)
      54.         out[k] = in[k] + fac * lagged[n + k - lag];
                                         ^
      55.     for (; k < n; k++)
      56.         out[k] = in[k] + fac * lagged[    k - lag];

void ff_celp_circ_addf(float *out, const float *in,
                       const float *lagged, int lag, float fac, int n)
{
    int k;
    for (k = 0; k < lag; k++)
        out[k] = in[k] + fac * lagged[n + k - lag];
    for (; k < n; k++)
        out[k] = in[k] + fac * lagged[    k - lag];
}
['static int amrnb_decode_frame(AVCodecContext *avctx, void *data,\n                              int *got_frame_ptr, AVPacket *avpkt)\n{\n    AMRContext *p = avctx->priv_data;\n    AVFrame *frame     = data;\n    const uint8_t *buf = avpkt->data;\n    int buf_size       = avpkt->size;\n    float *buf_out;\n    int i, subframe, ret;\n    float fixed_gain_factor;\n    AMRFixed fixed_sparse = {0};\n    float spare_vector[AMR_SUBFRAME_SIZE];\n    float synth_fixed_gain;\n    const float *synth_fixed_vector;\n    frame->nb_samples = AMR_BLOCK_SIZE;\n    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return ret;\n    }\n    buf_out = (float *)frame->data[0];\n    p->cur_frame_mode = unpack_bitstream(p, buf, buf_size);\n    if (p->cur_frame_mode == NO_DATA) {\n        av_log(avctx, AV_LOG_ERROR, "Corrupt bitstream\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if (p->cur_frame_mode == MODE_DTX) {\n        avpriv_request_sample(avctx, "dtx mode");\n        return AVERROR_PATCHWELCOME;\n    }\n    if (p->cur_frame_mode == MODE_12k2) {\n        lsf2lsp_5(p);\n    } else\n        lsf2lsp_3(p);\n    for (i = 0; i < 4; i++)\n        ff_acelp_lspd2lpc(p->lsp[i], p->lpc[i], 5);\n    for (subframe = 0; subframe < 4; subframe++) {\n        const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];\n        decode_pitch_vector(p, amr_subframe, subframe);\n        decode_fixed_sparse(&fixed_sparse, amr_subframe->pulses,\n                            p->cur_frame_mode, subframe);\n        decode_gains(p, amr_subframe, p->cur_frame_mode, subframe,\n                     &fixed_gain_factor);\n        pitch_sharpening(p, subframe, p->cur_frame_mode, &fixed_sparse);\n        if (fixed_sparse.pitch_lag == 0) {\n            av_log(avctx, AV_LOG_ERROR, "The file is corrupted, pitch_lag = 0 is not allowed\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        ff_set_fixed_vector(p->fixed_vector, &fixed_sparse, 1.0,\n                            AMR_SUBFRAME_SIZE);\n        p->fixed_gain[4] =\n            ff_amr_set_fixed_gain(fixed_gain_factor,\n                                  avpriv_scalarproduct_float_c(p->fixed_vector,\n                                                               p->fixed_vector,\n                                                               AMR_SUBFRAME_SIZE) /\n                                  AMR_SUBFRAME_SIZE,\n                       p->prediction_error,\n                       energy_mean[p->cur_frame_mode], energy_pred_fac);\n        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)\n            p->excitation[i] *= p->pitch_gain[4];\n        ff_set_fixed_vector(p->excitation, &fixed_sparse, p->fixed_gain[4],\n                            AMR_SUBFRAME_SIZE);\n        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)\n            p->excitation[i] = truncf(p->excitation[i]);\n        synth_fixed_gain = fixed_gain_smooth(p, p->lsf_q[subframe],\n                                             p->lsf_avg, p->cur_frame_mode);\n        synth_fixed_vector = anti_sparseness(p, &fixed_sparse, p->fixed_vector,\n                                             synth_fixed_gain, spare_vector);\n        if (synthesis(p, p->lpc[subframe], synth_fixed_gain,\n                      synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 0))\n            synthesis(p, p->lpc[subframe], synth_fixed_gain,\n                      synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 1);\n        postfilter(p, p->lpc[subframe], buf_out + subframe * AMR_SUBFRAME_SIZE);\n        ff_clear_fixed_vector(p->fixed_vector, &fixed_sparse, AMR_SUBFRAME_SIZE);\n        update_state(p);\n    }\n    ff_acelp_apply_order_2_transfer_function(buf_out, buf_out, highpass_zeros,\n                                             highpass_poles,\n                                             highpass_gain * AMR_SAMPLE_SCALE,\n                                             p->high_pass_mem, AMR_BLOCK_SIZE);\n    ff_weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3],\n                            0.84, 0.16, LP_FILTER_ORDER);\n    *got_frame_ptr = 1;\n    return frame_sizes_nb[p->cur_frame_mode] + 1;\n}', 'static void decode_pitch_vector(AMRContext *p,\n                                const AMRNBSubframe *amr_subframe,\n                                const int subframe)\n{\n    int pitch_lag_int, pitch_lag_frac;\n    enum Mode mode = p->cur_frame_mode;\n    if (p->cur_frame_mode == MODE_12k2) {\n        decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac,\n                             amr_subframe->p_lag, p->pitch_lag_int,\n                             subframe);\n    } else\n        ff_decode_pitch_lag(&pitch_lag_int, &pitch_lag_frac,\n                            amr_subframe->p_lag,\n                            p->pitch_lag_int, subframe,\n                            mode != MODE_4k75 && mode != MODE_5k15,\n                            mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6));\n    p->pitch_lag_int = pitch_lag_int;\n    pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2);\n    pitch_lag_int += pitch_lag_frac > 0;\n    ff_acelp_interpolatef(p->excitation, p->excitation + 1 - pitch_lag_int,\n                          ff_b60_sinc, 6,\n                          pitch_lag_frac + 6 - 6*(pitch_lag_frac > 0),\n                          10, AMR_SUBFRAME_SIZE);\n    memcpy(p->pitch_vector, p->excitation, AMR_SUBFRAME_SIZE * sizeof(float));\n}', 'static void decode_pitch_lag_1_6(int *lag_int, int *lag_frac, int pitch_index,\n                                 const int prev_lag_int, const int subframe)\n{\n    if (subframe == 0 || subframe == 2) {\n        if (pitch_index < 463) {\n            *lag_int  = (pitch_index + 107) * 10923 >> 16;\n            *lag_frac = pitch_index - *lag_int * 6 + 105;\n        } else {\n            *lag_int  = pitch_index - 368;\n            *lag_frac = 0;\n        }\n    } else {\n        *lag_int  = ((pitch_index + 5) * 10923 >> 16) - 1;\n        *lag_frac = pitch_index - *lag_int * 6 - 3;\n        *lag_int += av_clip(prev_lag_int - 5, PITCH_LAG_MIN_MODE_12k2,\n                            PITCH_DELAY_MAX - 9);\n    }\n}', 'static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode,\n                             AMRFixed *fixed_sparse)\n{\n    if (mode == MODE_12k2)\n        p->beta = FFMIN(p->pitch_gain[4], 1.0);\n    fixed_sparse->pitch_lag  = p->pitch_lag_int;\n    fixed_sparse->pitch_fac  = p->beta;\n    if (mode != MODE_4k75 || subframe & 1)\n        p->beta = av_clipf(p->pitch_gain[4], 0.0, SHARP_MAX);\n}', 'static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse,\n                                    const float *fixed_vector,\n                                    float fixed_gain, float *out)\n{\n    int ir_filter_nr;\n    if (p->pitch_gain[4] < 0.6) {\n        ir_filter_nr = 0;\n    } else if (p->pitch_gain[4] < 0.9) {\n        ir_filter_nr = 1;\n    } else\n        ir_filter_nr = 2;\n    if (fixed_gain > 2.0 * p->prev_sparse_fixed_gain) {\n        p->ir_filter_onset = 2;\n    } else if (p->ir_filter_onset)\n        p->ir_filter_onset--;\n    if (!p->ir_filter_onset) {\n        int i, count = 0;\n        for (i = 0; i < 5; i++)\n            if (p->pitch_gain[i] < 0.6)\n                count++;\n        if (count > 2)\n            ir_filter_nr = 0;\n        if (ir_filter_nr > p->prev_ir_filter_nr + 1)\n            ir_filter_nr--;\n    } else if (ir_filter_nr < 2)\n        ir_filter_nr++;\n    if (fixed_gain < 5.0)\n        ir_filter_nr = 2;\n    if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2\n         && ir_filter_nr < 2) {\n        apply_ir_filter(out, fixed_sparse,\n                        (p->cur_frame_mode == MODE_7k95 ?\n                             ir_filters_lookup_MODE_7k95 :\n                             ir_filters_lookup)[ir_filter_nr]);\n        fixed_vector = out;\n    }\n    p->prev_ir_filter_nr       = ir_filter_nr;\n    p->prev_sparse_fixed_gain  = fixed_gain;\n    return fixed_vector;\n}', 'static void apply_ir_filter(float *out, const AMRFixed *in,\n                            const float *filter)\n{\n    float filter1[AMR_SUBFRAME_SIZE],\n          filter2[AMR_SUBFRAME_SIZE];\n    int   lag = in->pitch_lag;\n    float fac = in->pitch_fac;\n    int i;\n    if (lag < AMR_SUBFRAME_SIZE) {\n        ff_celp_circ_addf(filter1, filter, filter, lag, fac,\n                          AMR_SUBFRAME_SIZE);\n        if (lag < AMR_SUBFRAME_SIZE >> 1)\n            ff_celp_circ_addf(filter2, filter, filter1, lag, fac,\n                              AMR_SUBFRAME_SIZE);\n    }\n    memset(out, 0, sizeof(float) * AMR_SUBFRAME_SIZE);\n    for (i = 0; i < in->n; i++) {\n        int   x = in->x[i];\n        float y = in->y[i];\n        const float *filterp;\n        if (x >= AMR_SUBFRAME_SIZE - lag) {\n            filterp = filter;\n        } else if (x >= AMR_SUBFRAME_SIZE - (lag << 1)) {\n            filterp = filter1;\n        } else\n            filterp = filter2;\n        ff_celp_circ_addf(out, out, filterp, x, y, AMR_SUBFRAME_SIZE);\n    }\n}', 'void ff_celp_circ_addf(float *out, const float *in,\n                       const float *lagged, int lag, float fac, int n)\n{\n    int k;\n    for (k = 0; k < lag; k++)\n        out[k] = in[k] + fac * lagged[n + k - lag];\n    for (; k < n; k++)\n        out[k] = in[k] + fac * lagged[    k - lag];\n}']