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

libavcodec/motion_est.c:1674:11: Call
1672. 
1673.     c->skip=0;
1674.     bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
                ^
1675. //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
1676. 

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

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

libavcodec/motion_est_template.c:1153:1: Parameter `ref_index`
    1151. 
    1152. //this function is dedicated to the braindamaged gcc
    1153. inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
          ^
    1154.                              int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
    1155.                              int ref_mv_scale, int size, int h)

libavcodec/motion_est_template.c:1160:16: Call
    1158. //FIXME convert other functions in the same way if faster
    1159.     if(c->flags==0 && h==16 && size==0){
    1160.         return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16);
                         ^
    1161. //    case FLAG_QPEL:
    1162. //        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:1036:1: Parameter `ref_index`
      1034.    optimal mv.
      1035.  */
      1036. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
            ^
      1037.                              int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
      1038.                              int ref_mv_scale, int flags, int size, int h)

libavcodec/motion_est_template.c:1142:11: Call
      1140. 
      1141. //check(best[0],best[1],0, b0)
      1142.     dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
                      ^
      1143. 
      1144. //check(best[0],best[1],0, b1)

libavcodec/motion_est_template.c:1008:1: Parameter `ref_index`
        1006. }
        1007. 
        1008. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
              ^
        1009.                                        int src_index, int ref_index, int const penalty_factor,
        1010.                                        int size, int h, int flags){

libavcodec/motion_est_template.c:1025:22: Call
        1023.         return           hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, c->dia_size&0xFF);
        1024.     else if(c->dia_size>256)
        1025.         return       l2s_dia_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
                                   ^
        1026.     else
        1027.         return   var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);

libavcodec/motion_est_template.c:694:1: Parameter `ref_index`
          692. }
          693. 
          694. static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
               ^
          695.                                        int src_index, int ref_index, int const penalty_factor,
          696.                                        int size, int h, int flags)

libavcodec/motion_est_template.c:717:17: Call
          715.             y= best[1];
          716.             for(i=0; i<8; i++){
          717.                 CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size);
                               ^
          718.             }
          719.         }while(best[0] != x || best[1] != y);

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:176:50: Array access: Offset: 10 (⇐ 2 + 8) Size: 4 by call to `ff_estimate_motion_b` 
            174. 
            175.                     c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16);
            176.                     c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16);
                                                                  ^
            177.                 }
            178.             }
