libavcodec/h264_slice.c:1720: error: Buffer Overrun L1
  Offset: [3, 21] (⇐ [2, 20] + 1) Size: 2 by call to `fill_filter_caches_inter`.

libavcodec/h264_slice.c:1720:9: Call
1718.                              top_type, left_type, mb_xy, 0);
1719.     if (sl->list_count == 2)
1720.         fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy,
              ^
1721.                                  top_type, left_type, mb_xy, 1);
1722. 

libavcodec/h264_slice.c:1562:1: <Offset trace>
1560. }
1561. 
1562. static av_always_inline void fill_filter_caches_inter(const H264Context *h,
      ^
1563.                                                       H264SliceContext *sl,
1564.                                                       int mb_type, int top_xy,

libavcodec/h264_slice.c:1562:1: Parameter `list`
  1560. }
  1561. 
  1562. static av_always_inline void fill_filter_caches_inter(const H264Context *h,
        ^
  1563.                                                       H264SliceContext *sl,
  1564.                                                       int mb_type, int top_xy,

libavcodec/h264_slice.c:1562:1: <Length trace>
1560. }
1561. 
1562. static av_always_inline void fill_filter_caches_inter(const H264Context *h,
      ^
1563.                                                       H264SliceContext *sl,
1564.                                                       int mb_type, int top_xy,

libavcodec/h264_slice.c:1562:1: Parameter `h->ref2frm[*][*]`
  1560. }
  1561. 
  1562. static av_always_inline void fill_filter_caches_inter(const H264Context *h,
        ^
  1563.                                                       H264SliceContext *sl,
  1564.                                                       int mb_type, int top_xy,

libavcodec/h264_slice.c:1577:13: Assignment
  1575.             const int b_xy  = h->mb2b_xy[top_xy] + 3 * b_stride;
  1576.             const int b8_xy = 4 * top_xy + 2;
  1577.             int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);
                    ^
  1578.             AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
  1579.             ref_cache[0 - 1 * 8] =

libavcodec/h264_slice.c:1580:36: Array access: Offset: [3, 21] (⇐ [2, 20] + 1) Size: 2 by call to `fill_filter_caches_inter` 
  1578.             AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
  1579.             ref_cache[0 - 1 * 8] =
  1580.             ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
                                           ^
  1581.             ref_cache[2 - 1 * 8] =
  1582.             ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];

static av_always_inline void fill_filter_caches_inter(const H264Context *h,
                                                      H264SliceContext *sl,
                                                      int mb_type, int top_xy,
                                                      int left_xy[LEFT_MBS],
                                                      int top_type,
                                                      int left_type[LEFT_MBS],
                                                      int mb_xy, int list)
{
    int b_stride = h->b_stride;
    int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]];
    int8_t *ref_cache   = &sl->ref_cache[list][scan8[0]];
    if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) {
        if (USES_LIST(top_type, list)) {
            const int b_xy  = h->mb2b_xy[top_xy] + 3 * b_stride;
            const int b8_xy = 4 * top_xy + 2;
            int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);
            AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
            ref_cache[0 - 1 * 8] =
            ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
            ref_cache[2 - 1 * 8] =
            ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];
        } else {
            AV_ZERO128(mv_dst - 1 * 8);
            AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
        }
        if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) {
            if (USES_LIST(left_type[LTOP], list)) {
                const int b_xy  = h->mb2b_xy[left_xy[LTOP]] + 3;
                const int b8_xy = 4 * left_xy[LTOP] + 1;
                int (*ref2frm)[64] = h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);
                AV_COPY32(mv_dst - 1 +  0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]);
                AV_COPY32(mv_dst - 1 +  8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]);
                AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]);
                AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]);
                ref_cache[-1 +  0] =
                ref_cache[-1 +  8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]];
                ref_cache[-1 + 16] =
                ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]];
            } else {
                AV_ZERO32(mv_dst - 1 +  0);
                AV_ZERO32(mv_dst - 1 +  8);
                AV_ZERO32(mv_dst - 1 + 16);
                AV_ZERO32(mv_dst - 1 + 24);
                ref_cache[-1 +  0] =
                ref_cache[-1 +  8] =
                ref_cache[-1 + 16] =
                ref_cache[-1 + 24] = LIST_NOT_USED;
            }
        }
    }
    if (!USES_LIST(mb_type, list)) {
        fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4);
        AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
        AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
        AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
        AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
        return;
    }
    {
        int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];
        int (*ref2frm)[64] = h->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);
        uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
        uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
        AV_WN32A(&ref_cache[0 * 8], ref01);
        AV_WN32A(&ref_cache[1 * 8], ref01);
        AV_WN32A(&ref_cache[2 * 8], ref23);
        AV_WN32A(&ref_cache[3 * 8], ref23);
    }
    {
        int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * b_stride];
        AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride);
        AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride);
        AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride);
        AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride);
    }
}
['static int fill_filter_caches(const H264Context *h, H264SliceContext *sl, int mb_type)\n{\n    const int mb_xy = sl->mb_xy;\n    int top_xy, left_xy[LEFT_MBS];\n    int top_type, left_type[LEFT_MBS];\n    uint8_t *nnz;\n    uint8_t *nnz_cache;\n    top_xy = mb_xy - (h->mb_stride << MB_FIELD(sl));\n    left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;\n    if (FRAME_MBAFF(h)) {\n        const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]);\n        const int curr_mb_field_flag = IS_INTERLACED(mb_type);\n        if (sl->mb_y & 1) {\n            if (left_mb_field_flag != curr_mb_field_flag)\n                left_xy[LTOP] -= h->mb_stride;\n        } else {\n            if (curr_mb_field_flag)\n                top_xy += h->mb_stride &\n                          (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1);\n            if (left_mb_field_flag != curr_mb_field_flag)\n                left_xy[LBOT] += h->mb_stride;\n        }\n    }\n    sl->top_mb_xy        = top_xy;\n    sl->left_mb_xy[LTOP] = left_xy[LTOP];\n    sl->left_mb_xy[LBOT] = left_xy[LBOT];\n    {\n        int qp_thresh = sl->qp_thresh;\n        int qp        = h->cur_pic.qscale_table[mb_xy];\n        if (qp <= qp_thresh &&\n            (left_xy[LTOP] < 0 ||\n             ((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) &&\n            (top_xy < 0 ||\n             ((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) {\n            if (!FRAME_MBAFF(h))\n                return 1;\n            if ((left_xy[LTOP] < 0 ||\n                 ((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) &&\n                (top_xy < h->mb_stride ||\n                 ((qp + h->cur_pic.qscale_table[top_xy - h->mb_stride] + 1) >> 1) <= qp_thresh))\n                return 1;\n        }\n    }\n    top_type        = h->cur_pic.mb_type[top_xy];\n    left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]];\n    left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]];\n    if (sl->deblocking_filter == 2) {\n        if (h->slice_table[top_xy] != sl->slice_num)\n            top_type = 0;\n        if (h->slice_table[left_xy[LBOT]] != sl->slice_num)\n            left_type[LTOP] = left_type[LBOT] = 0;\n    } else {\n        if (h->slice_table[top_xy] == 0xFFFF)\n            top_type = 0;\n        if (h->slice_table[left_xy[LBOT]] == 0xFFFF)\n            left_type[LTOP] = left_type[LBOT] = 0;\n    }\n    sl->top_type        = top_type;\n    sl->left_type[LTOP] = left_type[LTOP];\n    sl->left_type[LBOT] = left_type[LBOT];\n    if (IS_INTRA(mb_type))\n        return 0;\n    fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy,\n                             top_type, left_type, mb_xy, 0);\n    if (sl->list_count == 2)\n        fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy,\n                                 top_type, left_type, mb_xy, 1);\n    nnz       = h->non_zero_count[mb_xy];\n    nnz_cache = sl->non_zero_count_cache;\n    AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);\n    AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);\n    AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);\n    AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);\n    sl->cbp = h->cbp_table[mb_xy];\n    if (top_type) {\n        nnz = h->non_zero_count[top_xy];\n        AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);\n    }\n    if (left_type[LTOP]) {\n        nnz = h->non_zero_count[left_xy[LTOP]];\n        nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];\n        nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];\n        nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];\n        nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];\n    }\n    if (!CABAC(h) && h->ps.pps->transform_8x8_mode) {\n        if (IS_8x8DCT(top_type)) {\n            nnz_cache[4 + 8 * 0] =\n            nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;\n            nnz_cache[6 + 8 * 0] =\n            nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12;\n        }\n        if (IS_8x8DCT(left_type[LTOP])) {\n            nnz_cache[3 + 8 * 1] =\n            nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12;\n        }\n        if (IS_8x8DCT(left_type[LBOT])) {\n            nnz_cache[3 + 8 * 3] =\n            nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12;\n        }\n        if (IS_8x8DCT(mb_type)) {\n            nnz_cache[scan8[0]] =\n            nnz_cache[scan8[1]] =\n            nnz_cache[scan8[2]] =\n            nnz_cache[scan8[3]] = (sl->cbp & 0x1000) >> 12;\n            nnz_cache[scan8[0 + 4]] =\n            nnz_cache[scan8[1 + 4]] =\n            nnz_cache[scan8[2 + 4]] =\n            nnz_cache[scan8[3 + 4]] = (sl->cbp & 0x2000) >> 12;\n            nnz_cache[scan8[0 + 8]] =\n            nnz_cache[scan8[1 + 8]] =\n            nnz_cache[scan8[2 + 8]] =\n            nnz_cache[scan8[3 + 8]] = (sl->cbp & 0x4000) >> 12;\n            nnz_cache[scan8[0 + 12]] =\n            nnz_cache[scan8[1 + 12]] =\n            nnz_cache[scan8[2 + 12]] =\n            nnz_cache[scan8[3 + 12]] = (sl->cbp & 0x8000) >> 12;\n        }\n    }\n    return 0;\n}', 'static av_always_inline void fill_filter_caches_inter(const H264Context *h,\n                                                      H264SliceContext *sl,\n                                                      int mb_type, int top_xy,\n                                                      int left_xy[LEFT_MBS],\n                                                      int top_type,\n                                                      int left_type[LEFT_MBS],\n                                                      int mb_xy, int list)\n{\n    int b_stride = h->b_stride;\n    int16_t(*mv_dst)[2] = &sl->mv_cache[list][scan8[0]];\n    int8_t *ref_cache   = &sl->ref_cache[list][scan8[0]];\n    if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) {\n        if (USES_LIST(top_type, list)) {\n            const int b_xy  = h->mb2b_xy[top_xy] + 3 * b_stride;\n            const int b8_xy = 4 * top_xy + 2;\n            int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);\n            AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);\n            ref_cache[0 - 1 * 8] =\n            ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];\n            ref_cache[2 - 1 * 8] =\n            ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];\n        } else {\n            AV_ZERO128(mv_dst - 1 * 8);\n            AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);\n        }\n        if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) {\n            if (USES_LIST(left_type[LTOP], list)) {\n                const int b_xy  = h->mb2b_xy[left_xy[LTOP]] + 3;\n                const int b8_xy = 4 * left_xy[LTOP] + 1;\n                int (*ref2frm)[64] = h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);\n                AV_COPY32(mv_dst - 1 +  0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]);\n                AV_COPY32(mv_dst - 1 +  8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]);\n                AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]);\n                AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]);\n                ref_cache[-1 +  0] =\n                ref_cache[-1 +  8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]];\n                ref_cache[-1 + 16] =\n                ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]];\n            } else {\n                AV_ZERO32(mv_dst - 1 +  0);\n                AV_ZERO32(mv_dst - 1 +  8);\n                AV_ZERO32(mv_dst - 1 + 16);\n                AV_ZERO32(mv_dst - 1 + 24);\n                ref_cache[-1 +  0] =\n                ref_cache[-1 +  8] =\n                ref_cache[-1 + 16] =\n                ref_cache[-1 + 24] = LIST_NOT_USED;\n            }\n        }\n    }\n    if (!USES_LIST(mb_type, list)) {\n        fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4);\n        AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);\n        AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);\n        AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);\n        AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);\n        return;\n    }\n    {\n        int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];\n        int (*ref2frm)[64] = h->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2);\n        uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;\n        uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;\n        AV_WN32A(&ref_cache[0 * 8], ref01);\n        AV_WN32A(&ref_cache[1 * 8], ref01);\n        AV_WN32A(&ref_cache[2 * 8], ref23);\n        AV_WN32A(&ref_cache[3 * 8], ref23);\n    }\n    {\n        int16_t(*mv_src)[2] = &h->cur_pic.motion_val[list][4 * sl->mb_x + 4 * sl->mb_y * b_stride];\n        AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride);\n        AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride);\n        AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride);\n        AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride);\n    }\n}']