libavcodec/g722.c:363: error: Buffer Overrun L2
  Offset: [1+min(22, `avctx->priv_data->prev_samples_pos`), 1+max(1023, `avctx->priv_data->prev_samples_pos`)] Size: 1024 by call to `filter_samples`.

libavcodec/g722.c:354:1: Parameter `avctx->priv_data->prev_samples_pos`
352. }
353. 
354. static int g722_encode_frame(AVCodecContext *avctx,
     ^
355.                              uint8_t *dst, int buf_size, void *data)
356. {

libavcodec/g722.c:363:9: Call
361.     for (i = 0; i < buf_size >> 1; i++) {
362.         int xlow, xhigh, ihigh, ilow;
363.         filter_samples(c, &samples[2*i], &xlow, &xhigh);
             ^
364.         ihigh = encode_high(&c->band[1], xhigh);
365.         ilow  = encode_low(&c->band[0], xlow);

libavcodec/g722.c:315:1: <Offset trace>
313. };
314. 
315. static inline void filter_samples(G722Context *c, const int16_t *samples,
     ^
316.                                   int *xlow, int *xhigh)
317. {

libavcodec/g722.c:315:1: Parameter `c->prev_samples_pos`
  313. };
  314. 
  315. static inline void filter_samples(G722Context *c, const int16_t *samples,
       ^
  316.                                   int *xlow, int *xhigh)
  317. {

libavcodec/g722.c:319:21: Assignment
  317. {
  318.     int xout1, xout2;
  319.     c->prev_samples[c->prev_samples_pos++] = samples[0];
                           ^
  320.     c->prev_samples[c->prev_samples_pos++] = samples[1];
  321.     apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);

libavcodec/g722.c:315:1: <Length trace>
313. };
314. 
315. static inline void filter_samples(G722Context *c, const int16_t *samples,
     ^
316.                                   int *xlow, int *xhigh)
317. {

libavcodec/g722.c:315:1: Parameter `c->prev_samples[*]`
  313. };
  314. 
  315. static inline void filter_samples(G722Context *c, const int16_t *samples,
       ^
  316.                                   int *xlow, int *xhigh)
  317. {

libavcodec/g722.c:320:5: Array access: Offset: [1+min(22, avctx->priv_data->prev_samples_pos), 1+max(1023, avctx->priv_data->prev_samples_pos)] Size: 1024 by call to `filter_samples` 
  318.     int xout1, xout2;
  319.     c->prev_samples[c->prev_samples_pos++] = samples[0];
  320.     c->prev_samples[c->prev_samples_pos++] = samples[1];
           ^
  321.     apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);
  322.     *xlow  = xout1 + xout2 >> 13;

static inline void filter_samples(G722Context *c, const int16_t *samples,
                                  int *xlow, int *xhigh)
{
    int xout1, xout2;
    c->prev_samples[c->prev_samples_pos++] = samples[0];
    c->prev_samples[c->prev_samples_pos++] = samples[1];
    apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);
    *xlow  = xout1 + xout2 >> 13;
    *xhigh = xout1 - xout2 >> 13;
    if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
        memmove(c->prev_samples,
                c->prev_samples + c->prev_samples_pos - 22,
                22 * sizeof(c->prev_samples[0]));
        c->prev_samples_pos = 22;
    }
}
['static int g722_encode_frame(AVCodecContext *avctx,\n                             uint8_t *dst, int buf_size, void *data)\n{\n    G722Context *c = avctx->priv_data;\n    const int16_t *samples = data;\n    int i;\n    for (i = 0; i < buf_size >> 1; i++) {\n        int xlow, xhigh, ihigh, ilow;\n        filter_samples(c, &samples[2*i], &xlow, &xhigh);\n        ihigh = encode_high(&c->band[1], xhigh);\n        ilow  = encode_low(&c->band[0], xlow);\n        update_high_predictor(&c->band[1], c->band[1].scale_factor *\n                              high_inv_quant[ihigh] >> 10, ihigh);\n        update_low_predictor(&c->band[0], ilow >> 2);\n        *dst++ = ihigh << 6 | ilow;\n    }\n    return i;\n}', 'static inline void filter_samples(G722Context *c, const int16_t *samples,\n                                  int *xlow, int *xhigh)\n{\n    int xout1, xout2;\n    c->prev_samples[c->prev_samples_pos++] = samples[0];\n    c->prev_samples[c->prev_samples_pos++] = samples[1];\n    apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);\n    *xlow  = xout1 + xout2 >> 13;\n    *xhigh = xout1 - xout2 >> 13;\n    if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {\n        memmove(c->prev_samples,\n                c->prev_samples + c->prev_samples_pos - 22,\n                22 * sizeof(c->prev_samples[0]));\n        c->prev_samples_pos = 22;\n    }\n}']