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

libavcodec/motion_est.c:877:1: Parameter `*s->current_picture_ptr->ref_index[*]`
875. }
876. 
877. static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
     ^
878.     MotionEstContext * const c= &s->me;
879.     Picture *p= s->current_picture_ptr;

libavcodec/motion_est.c:943:13: Assignment
941.         }
942.         if(USES_LIST(mb_type, 1)){
943.             int field_select0= p->ref_index[1][4*mb_xy  ];
                 ^
944.             int field_select1= p->ref_index[1][4*mb_xy+2];
945.             assert(field_select0==0 ||field_select0==1);

libavcodec/motion_est.c:961:17: Call
959.             x= p->motion_val[1][xy ][0];
960.             y= p->motion_val[1][xy ][1];
961.             d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
                     ^
962.             x= p->motion_val[1][xy2][0];
963.             y= p->motion_val[1][xy2][1];

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

libavcodec/motion_est.c:260:16: Call
  258.        && av_builtin_constant_p(subx) && av_builtin_constant_p(suby)
  259.        && flags==0 && h==16 && size==0 && subx==0 && suby==0){
  260.         return cmp_simple(s,x,y,ref_index,src_index, cmp_func, chroma_cmp_func);
                      ^
  261.     }else if(av_builtin_constant_p(subx) && av_builtin_constant_p(suby)
  262.        && subx==0 && suby==0){

libavcodec/motion_est.c:225:1: Parameter `ref_index`
    223. }
    224. 
    225. static int cmp_simple(MpegEncContext *s, const int x, const int y,
         ^
    226.                       int ref_index, int src_index,
    227.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func){

libavcodec/motion_est.c:228:12: Call
    226.                       int ref_index, int src_index,
    227.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func){
    228.     return cmp_inline(s,x,y,0,0,0,16,ref_index,src_index, cmp_func, chroma_cmp_func, 0, 0);
                    ^
    229. }
    230. 

libavcodec/motion_est.c:179:1: <Length trace>
177. }
178. 
179. static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
     ^
180.                       const int size, const int h, int ref_index, int src_index,
181.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma){

libavcodec/motion_est.c:179:1: Parameter `ref_index`
      177. }
      178. 
      179. static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
           ^
      180.                       const int size, const int h, int ref_index, int src_index,
      181.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma){

libavcodec/motion_est.c:188:5: Assignment
      186.     const int hx= subx + (x<<(1+qpel));
      187.     const int hy= suby + (y<<(1+qpel));
      188.     uint8_t * const * const ref= c->ref[ref_index];
               ^
      189.     uint8_t * const * const src= c->src[src_index];
      190.     int d;

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