libavcodec/motion_est.c:1722: error: Buffer Overrun L1
  Offset: 10 (⇐ 2 + 8) Size: 4 by call to `ff_estimate_motion_b`.

libavcodec/motion_est.c:1722:11: Call
1720. 
1721.     c->skip=0;
1722.     bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
                ^
1723.     av_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
1724. 

libavcodec/motion_est.c:1250:1: Parameter `ref_index`
  1248. }
  1249. 
  1250. static int ff_estimate_motion_b(MpegEncContext * s,
        ^
  1251.                        int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code)
  1252. {

libavcodec/motion_est.c:1305:16: Call
  1303.         }
  1304. 
  1305.         dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16);
                       ^
  1306. 
  1307.         break;

libavcodec/motion_est_template.c:974:1: Parameter `ref_index`
    972. 
    973. //this function is dedicated to the braindamaged gcc
    974. int ff_epzs_motion_search(MpegEncContext *s, int *mx_ptr, int *my_ptr,
         ^
    975.                           int P[10][2], int src_index, int ref_index,
    976.                           int16_t (*last_mv)[2], int ref_mv_scale,

libavcodec/motion_est_template.c:982:16: Call
    980. //FIXME convert other functions in the same way if faster
    981.     if(c->flags==0 && h==16 && size==0){
    982.         return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16);
                        ^
    983. //    case FLAG_QPEL:
    984. //        return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL);

libavcodec/motion_est_template.c:858:1: Parameter `ref_index`
      856.    optimal mv.
      857.  */
      858. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
           ^
      859.                              int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
      860.                              int ref_mv_scale, int flags, int size, int h)

libavcodec/motion_est_template.c:964:11: Call
      962. 
      963. //check(best[0],best[1],0, b0)
      964.     dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
                     ^
      965. 
      966. //check(best[0],best[1],0, b1)

libavcodec/motion_est_template.c:830:1: Parameter `ref_index`
        828. }
        829. 
        830. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
             ^
        831.                                        int src_index, int ref_index, int const penalty_factor,
        832.                                        int size, int h, int flags){

libavcodec/motion_est_template.c:847:22: Call
        845.         return           hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, c->dia_size&0xFF);
        846.     else if(c->dia_size>256)
        847.         return       l2s_dia_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
                                  ^
        848.     else
        849.         return   var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);

libavcodec/motion_est_template.c:534:1: Parameter `ref_index`
          532. }
          533. 
          534. static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
               ^
          535.                                        int src_index, int ref_index, int const penalty_factor,
          536.                                        int size, int h, int flags)

libavcodec/motion_est_template.c:557:17: Call
          555.             y= best[1];
          556.             for(i=0; i<8; i++){
          557.                 CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size);
                               ^
          558.             }
          559.         }while(best[0] != x || best[1] != y);

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

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

libavcodec/motion_est.c:229:1: Parameter `ref_index`
              227. }
              228. 
              229. static int cmp_fpel_internal(MpegEncContext *s, const int x, const int y,
                   ^
              230.                       const int size, const int h, int ref_index, int src_index,
              231.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){

libavcodec/motion_est.c:233:16: Call
              231.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
              232.     if(flags&FLAG_DIRECT){
              233.         return cmp_direct_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL);
                                  ^
              234.     }else{
              235.         return cmp_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA);

libavcodec/motion_est.c:105:1: <Length trace>
103. }
104. 
105. static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
     ^
106.                       const int size, const int h, int ref_index, int src_index,
107.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){

libavcodec/motion_est.c:105:1: Parameter `ref_index`
                103. }
                104. 
                105. static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
                     ^
                106.                       const int size, const int h, int ref_index, int src_index,
                107.                       me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){

libavcodec/motion_est.c:112:5: Assignment
                110.     const int hx= subx + (x<<(1+qpel));
                111.     const int hy= suby + (y<<(1+qpel));
                112.     uint8_t * const * const ref= c->ref[ref_index];
                         ^
                113.     uint8_t * const * const src= c->src[src_index];
                114.     int d;

libavcodec/motion_est.c:134:50: Array access: Offset: 10 (⇐ 2 + 8) Size: 4 by call to `ff_estimate_motion_b` 
                132.                     if(qpel){
                133.                         c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride);
                134.                         c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride);
                                                                      ^
                135.                     }else{
                136.                         c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8);
