libavcodec/g722enc.c:357: 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 `encode_byte`.

libavcodec/g722enc.c:340:1: Parameter `avctx->priv_data->prev_samples_pos`
338. }
339. 
340. static int g722_encode_frame(AVCodecContext *avctx,
     ^
341.                              uint8_t *dst, int buf_size, void *data)
342. {

libavcodec/g722enc.c:350:9: Call
348. 
349.     if (avctx->trellis)
350.         g722_encode_trellis(c, avctx->trellis, dst, nb_samples, samples);
             ^
351.     else
352.         g722_encode_no_trellis(c, dst, nb_samples, samples);

libavcodec/g722enc.c:163:1: Parameter `c->prev_samples_pos`
  161. }
  162. 
  163. static void g722_encode_trellis(G722Context *c, int trellis,
       ^
  164.                                 uint8_t *dst, int nb_samples,
  165.                                 const int16_t *samples)

libavcodec/g722enc.c:357:9: Call
355.     if (nb_samples < avctx->frame_size) {
356.         int16_t last_samples[2] = { samples[nb_samples], samples[nb_samples] };
357.         encode_byte(c, &dst[nb_samples >> 1], last_samples);
             ^
358.     }
359. 

libavcodec/g722enc.c:318:1: Parameter `c->prev_samples_pos`
  316. }
  317. 
  318. static av_always_inline void encode_byte(G722Context *c, uint8_t *dst,
       ^
  319.                                          const int16_t *samples)
  320. {

libavcodec/g722enc.c:322:5: Call
  320. {
  321.     int xlow, xhigh, ilow, ihigh;
  322.     filter_samples(c, samples, &xlow, &xhigh);
           ^
  323.     ihigh = encode_high(&c->band[1], xhigh);
  324.     ilow  = encode_low (&c->band[0], xlow);

libavcodec/g722enc.c:124:1: <Offset trace>
122. };
123. 
124. static inline void filter_samples(G722Context *c, const int16_t *samples,
     ^
125.                                   int *xlow, int *xhigh)
126. {

libavcodec/g722enc.c:124:1: Parameter `c->prev_samples_pos`
    122. };
    123. 
    124. static inline void filter_samples(G722Context *c, const int16_t *samples,
         ^
    125.                                   int *xlow, int *xhigh)
    126. {

libavcodec/g722enc.c:128:21: Assignment
    126. {
    127.     int xout1, xout2;
    128.     c->prev_samples[c->prev_samples_pos++] = samples[0];
                             ^
    129.     c->prev_samples[c->prev_samples_pos++] = samples[1];
    130.     ff_g722_apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);

libavcodec/g722enc.c:124:1: <Length trace>
122. };
123. 
124. static inline void filter_samples(G722Context *c, const int16_t *samples,
     ^
125.                                   int *xlow, int *xhigh)
126. {

libavcodec/g722enc.c:124:1: Parameter `c->prev_samples[*]`
    122. };
    123. 
    124. static inline void filter_samples(G722Context *c, const int16_t *samples,
         ^
    125.                                   int *xlow, int *xhigh)
    126. {

libavcodec/g722enc.c:129: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 `encode_byte` 
    127.     int xout1, xout2;
    128.     c->prev_samples[c->prev_samples_pos++] = samples[0];
    129.     c->prev_samples[c->prev_samples_pos++] = samples[1];
             ^
    130.     ff_g722_apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);
    131.     *xlow  = xout1 + xout2 >> 13;
