libavcodec/motion_est.c:899: error: Buffer Overrun L2
  Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `cmp`.

libavcodec/motion_est.c:815:1: Parameter `*s->current_picture_ptr->ref_index[*]`
813. }
814. 
815. static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
     ^
816.     MotionEstContext * const c= &s->me;
817.     Picture *p= s->current_picture_ptr;

libavcodec/motion_est.c:881:13: Assignment
879.         }
880.         if(USES_LIST(mb_type, 1)){
881.             int field_select0= p->ref_index[1][4*mb_xy  ];
                 ^
882.             int field_select1= p->ref_index[1][4*mb_xy+2];
883.             assert(field_select0==0 ||field_select0==1);

libavcodec/motion_est.c:899:17: Call
897.             x= p->motion_val[1][xy ][0];
898.             y= p->motion_val[1][xy ][1];
899.             d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
                     ^
900.             x= p->motion_val[1][xy2][0];
901.             y= p->motion_val[1][xy2][1];

libavcodec/motion_est.c:110:1: <Length trace>
108.     against a proposed motion-compensated prediction of that block
109.  */
110. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
     ^
111.                       const int size, const int h, int ref_index, int src_index,
112.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){

libavcodec/motion_est.c:110:1: Parameter `ref_index`
  108.     against a proposed motion-compensated prediction of that block
  109.  */
  110. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
       ^
  111.                       const int size, const int h, int ref_index, int src_index,
  112.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){

libavcodec/motion_est.c:121:5: Assignment
  119.     const int hx= subx + (x<<(1+qpel));
  120.     const int hy= suby + (y<<(1+qpel));
  121.     uint8_t * const * const ref= c->ref[ref_index];
           ^
  122.     uint8_t * const * const src= c->src[src_index];
  123.     int d;

libavcodec/motion_est.c:210:50: Array access: Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `cmp` 
  208.         if(chroma){
  209.             uint8_t * const uvtemp= c->temp + 16*stride;
  210.             c->hpel_put[size+1][uvdxy](uvtemp  , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
                                                        ^
  211.             c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
  212.             d += chroma_cmp_func(s, uvtemp  , src[1], uvstride, h>>1);
