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

libavcodec/motion_est.c:1025:1: Parameter `*s->current_picture_ptr->ref_index[*]`
1023. }
1024. 
1025. static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
      ^
1026.     MotionEstContext * const c= &s->me;
1027.     Picture *p= s->current_picture_ptr;

libavcodec/motion_est.c:1091:13: Assignment
1089.         }
1090.         if(USES_LIST(mb_type, 1)){
1091.             int field_select0= p->ref_index[1][xy ];
                  ^
1092.             int field_select1= p->ref_index[1][xy2];
1093.             assert(field_select0==0 ||field_select0==1);

libavcodec/motion_est.c:1109:17: Call
1107.             x= p->motion_val[1][xy ][0];
1108.             y= p->motion_val[1][xy ][1];
1109.             d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
                      ^
1110.             x= p->motion_val[1][xy2][0];
1111.             y= p->motion_val[1][xy2][1];

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

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

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

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