libavcodec/hevc.c:2107: error: Buffer Overrun L1
  Offset: -1 Size: 5 by call to `hls_transform_tree`.

libavcodec/hevc.c:2107:17: Call
2105.                                          s->sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag :
2106.                                          s->sps->max_transform_hierarchy_depth_inter;
2107.                 hls_transform_tree(s, x0, y0, x0, y0, x0, y0, log2_cb_size,
                      ^
2108.                                    log2_cb_size, 0, 0);
2109.             } else {

libavcodec/hevc.c:1272:1: <Offset trace>
1270. }
1271. 
1272. static void hls_transform_tree(HEVCContext *s, int x0, int y0,
      ^
1273.                                int xBase, int yBase, int cb_xBase, int cb_yBase,
1274.                                int log2_cb_size, int log2_trafo_size,

libavcodec/hevc.c:1272:1: Parameter `trafo_depth`
  1270. }
  1271. 
  1272. static void hls_transform_tree(HEVCContext *s, int x0, int y0,
        ^
  1273.                                int xBase, int yBase, int cb_xBase, int cb_yBase,
  1274.                                int log2_cb_size, int log2_trafo_size,

libavcodec/hevc.c:1272:1: <Length trace>
1270. }
1271. 
1272. static void hls_transform_tree(HEVCContext *s, int x0, int y0,
      ^
1273.                                int xBase, int yBase, int cb_xBase, int cb_yBase,
1274.                                int log2_cb_size, int log2_trafo_size,

libavcodec/hevc.c:1272:1: Parameter `s->HEVClc.tt.cbf_cb[*]`
  1270. }
  1271. 
  1272. static void hls_transform_tree(HEVCContext *s, int x0, int y0,
        ^
  1273.                                int xBase, int yBase, int cb_xBase, int cb_yBase,
  1274.                                int log2_cb_size, int log2_trafo_size,

libavcodec/hevc.c:1317:13: Array access: Offset: -1 Size: 5 by call to `hls_transform_tree` 
  1315.     if (log2_trafo_size > 2) {
  1316.         if (trafo_depth == 0 ||
  1317.             SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth - 1], xBase, yBase)) {
                    ^
  1318.             SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =
  1319.                 ff_hevc_cbf_cb_cr_decode(s, trafo_depth);

static void hls_transform_tree(HEVCContext *s, int x0, int y0,
                               int xBase, int yBase, int cb_xBase, int cb_yBase,
                               int log2_cb_size, int log2_trafo_size,
                               int trafo_depth, int blk_idx)
{
    HEVCLocalContext *lc = &s->HEVClc;
    uint8_t split_transform_flag;
    if (trafo_depth > 0 && log2_trafo_size == 2) {
        SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =
            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth - 1], xBase, yBase);
        SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) =
            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase);
    } else {
        SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =
        SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) = 0;
    }
    if (lc->cu.intra_split_flag) {
        if (trafo_depth == 1)
            lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[blk_idx];
    } else {
        lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[0];
    }
    lc->tt.cbf_luma = 1;
    lc->tt.inter_split_flag = s->sps->max_transform_hierarchy_depth_inter == 0 &&
                              lc->cu.pred_mode == MODE_INTER &&
                              lc->cu.part_mode != PART_2Nx2N &&
                              trafo_depth == 0;
    if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
        log2_trafo_size >  s->sps->log2_min_tb_size    &&
        trafo_depth     < lc->cu.max_trafo_depth       &&
        !(lc->cu.intra_split_flag && trafo_depth == 0)) {
        split_transform_flag = ff_hevc_split_transform_flag_decode(s, log2_trafo_size);
    } else {
        split_transform_flag = log2_trafo_size > s->sps->log2_max_trafo_size ||
                               (lc->cu.intra_split_flag && trafo_depth == 0) ||
                               lc->tt.inter_split_flag;
    }
    if (log2_trafo_size > 2) {
        if (trafo_depth == 0 ||
            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth - 1], xBase, yBase)) {
            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =
                ff_hevc_cbf_cb_cr_decode(s, trafo_depth);
        }
        if (trafo_depth == 0 ||
            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase)) {
            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) =
                ff_hevc_cbf_cb_cr_decode(s, trafo_depth);
        }
    }
    if (split_transform_flag) {
        int x1 = x0 + ((1 << log2_trafo_size) >> 1);
        int y1 = y0 + ((1 << log2_trafo_size) >> 1);
        hls_transform_tree(s, x0, y0, x0, y0, cb_xBase, cb_yBase, log2_cb_size,
                           log2_trafo_size - 1, trafo_depth + 1, 0);
        hls_transform_tree(s, x1, y0, x0, y0, cb_xBase, cb_yBase, log2_cb_size,
                           log2_trafo_size - 1, trafo_depth + 1, 1);
        hls_transform_tree(s, x0, y1, x0, y0, cb_xBase, cb_yBase, log2_cb_size,
                           log2_trafo_size - 1, trafo_depth + 1, 2);
        hls_transform_tree(s, x1, y1, x0, y0, cb_xBase, cb_yBase, log2_cb_size,
                           log2_trafo_size - 1, trafo_depth + 1, 3);
    } else {
        int min_tu_size      = 1 << s->sps->log2_min_tb_size;
        int log2_min_tu_size = s->sps->log2_min_tb_size;
        int min_tu_width     = s->sps->min_tb_width;
        if (lc->cu.pred_mode == MODE_INTRA || trafo_depth != 0 ||
            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) ||
            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0)) {
            lc->tt.cbf_luma = ff_hevc_cbf_luma_decode(s, trafo_depth);
        }
        hls_transform_unit(s, x0, y0, xBase, yBase, cb_xBase, cb_yBase,
                           log2_cb_size, log2_trafo_size, trafo_depth, blk_idx);
        if (lc->tt.cbf_luma) {
            int i, j;
            for (i = 0; i < (1 << log2_trafo_size); i += min_tu_size)
                for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {
                    int x_tu = (x0 + j) >> log2_min_tu_size;
                    int y_tu = (y0 + i) >> log2_min_tu_size;
                    s->cbf_luma[y_tu * min_tu_width + x_tu] = 1;
                }
        }
        if (!s->sh.disable_deblocking_filter_flag) {
            ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_trafo_size,
                                                  lc->slice_or_tiles_up_boundary,
                                                  lc->slice_or_tiles_left_boundary);
            if (s->pps->transquant_bypass_enable_flag &&
                lc->cu.cu_transquant_bypass_flag)
                set_deblocking_bypass(s, x0, y0, log2_trafo_size);
        }
    }
}
['static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)\n{\n    int cb_size          = 1 << log2_cb_size;\n    HEVCLocalContext *lc = &s->HEVClc;\n    int log2_min_cb_size = s->sps->log2_min_cb_size;\n    int length           = cb_size >> log2_min_cb_size;\n    int min_cb_width     = s->sps->min_cb_width;\n    int x_cb             = x0 >> log2_min_cb_size;\n    int y_cb             = y0 >> log2_min_cb_size;\n    int x, y;\n    lc->cu.x                = x0;\n    lc->cu.y                = y0;\n    lc->cu.rqt_root_cbf     = 1;\n    lc->cu.pred_mode        = MODE_INTRA;\n    lc->cu.part_mode        = PART_2Nx2N;\n    lc->cu.intra_split_flag = 0;\n    lc->cu.pcm_flag         = 0;\n    SAMPLE_CTB(s->skip_flag, x_cb, y_cb) = 0;\n    for (x = 0; x < 4; x++)\n        lc->pu.intra_pred_mode[x] = 1;\n    if (s->pps->transquant_bypass_enable_flag) {\n        lc->cu.cu_transquant_bypass_flag = ff_hevc_cu_transquant_bypass_flag_decode(s);\n        if (lc->cu.cu_transquant_bypass_flag)\n            set_deblocking_bypass(s, x0, y0, log2_cb_size);\n    } else\n        lc->cu.cu_transquant_bypass_flag = 0;\n    if (s->sh.slice_type != I_SLICE) {\n        uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb);\n        lc->cu.pred_mode = MODE_SKIP;\n        x = y_cb * min_cb_width + x_cb;\n        for (y = 0; y < length; y++) {\n            memset(&s->skip_flag[x], skip_flag, length);\n            x += min_cb_width;\n        }\n        lc->cu.pred_mode = skip_flag ? MODE_SKIP : MODE_INTER;\n    }\n    if (SAMPLE_CTB(s->skip_flag, x_cb, y_cb)) {\n        hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0);\n        intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);\n        if (!s->sh.disable_deblocking_filter_flag)\n            ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_cb_size,\n                                                  lc->slice_or_tiles_up_boundary,\n                                                  lc->slice_or_tiles_left_boundary);\n    } else {\n        if (s->sh.slice_type != I_SLICE)\n            lc->cu.pred_mode = ff_hevc_pred_mode_decode(s);\n        if (lc->cu.pred_mode != MODE_INTRA ||\n            log2_cb_size == s->sps->log2_min_cb_size) {\n            lc->cu.part_mode        = ff_hevc_part_mode_decode(s, log2_cb_size);\n            lc->cu.intra_split_flag = lc->cu.part_mode == PART_NxN &&\n                                      lc->cu.pred_mode == MODE_INTRA;\n        }\n        if (lc->cu.pred_mode == MODE_INTRA) {\n            if (lc->cu.part_mode == PART_2Nx2N && s->sps->pcm_enabled_flag &&\n                log2_cb_size >= s->sps->pcm.log2_min_pcm_cb_size &&\n                log2_cb_size <= s->sps->pcm.log2_max_pcm_cb_size) {\n                lc->cu.pcm_flag = ff_hevc_pcm_flag_decode(s);\n            }\n            if (lc->cu.pcm_flag) {\n                int ret;\n                intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);\n                ret = hls_pcm_sample(s, x0, y0, log2_cb_size);\n                if (s->sps->pcm.loop_filter_disable_flag)\n                    set_deblocking_bypass(s, x0, y0, log2_cb_size);\n                if (ret < 0)\n                    return ret;\n            } else {\n                intra_prediction_unit(s, x0, y0, log2_cb_size);\n            }\n        } else {\n            intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);\n            switch (lc->cu.part_mode) {\n            case PART_2Nx2N:\n                hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0);\n                break;\n            case PART_2NxN:\n                hls_prediction_unit(s, x0, y0,               cb_size, cb_size / 2, log2_cb_size, 0);\n                hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1);\n                break;\n            case PART_Nx2N:\n                hls_prediction_unit(s, x0,               y0, cb_size / 2, cb_size, log2_cb_size, 0);\n                hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1);\n                break;\n            case PART_2NxnU:\n                hls_prediction_unit(s, x0, y0,               cb_size, cb_size     / 4, log2_cb_size, 0);\n                hls_prediction_unit(s, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1);\n                break;\n            case PART_2NxnD:\n                hls_prediction_unit(s, x0, y0,                   cb_size, cb_size * 3 / 4, log2_cb_size, 0);\n                hls_prediction_unit(s, x0, y0 + cb_size * 3 / 4, cb_size, cb_size     / 4, log2_cb_size, 1);\n                break;\n            case PART_nLx2N:\n                hls_prediction_unit(s, x0,               y0, cb_size     / 4, cb_size, log2_cb_size, 0);\n                hls_prediction_unit(s, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1);\n                break;\n            case PART_nRx2N:\n                hls_prediction_unit(s, x0,                   y0, cb_size * 3 / 4, cb_size, log2_cb_size, 0);\n                hls_prediction_unit(s, x0 + cb_size * 3 / 4, y0, cb_size     / 4, cb_size, log2_cb_size, 1);\n                break;\n            case PART_NxN:\n                hls_prediction_unit(s, x0,               y0,               cb_size / 2, cb_size / 2, log2_cb_size, 0);\n                hls_prediction_unit(s, x0 + cb_size / 2, y0,               cb_size / 2, cb_size / 2, log2_cb_size, 1);\n                hls_prediction_unit(s, x0,               y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2);\n                hls_prediction_unit(s, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3);\n                break;\n            }\n        }\n        if (!lc->cu.pcm_flag) {\n            if (lc->cu.pred_mode != MODE_INTRA &&\n                !(lc->cu.part_mode == PART_2Nx2N && lc->pu.merge_flag)) {\n                lc->cu.rqt_root_cbf = ff_hevc_no_residual_syntax_flag_decode(s);\n            }\n            if (lc->cu.rqt_root_cbf) {\n                lc->cu.max_trafo_depth = lc->cu.pred_mode == MODE_INTRA ?\n                                         s->sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag :\n                                         s->sps->max_transform_hierarchy_depth_inter;\n                hls_transform_tree(s, x0, y0, x0, y0, x0, y0, log2_cb_size,\n                                   log2_cb_size, 0, 0);\n            } else {\n                if (!s->sh.disable_deblocking_filter_flag)\n                    ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_cb_size,\n                                                          lc->slice_or_tiles_up_boundary,\n                                                          lc->slice_or_tiles_left_boundary);\n            }\n        }\n    }\n    if (s->pps->cu_qp_delta_enabled_flag && lc->tu.is_cu_qp_delta_coded == 0)\n        ff_hevc_set_qPy(s, x0, y0, x0, y0, log2_cb_size);\n    x = y_cb * min_cb_width + x_cb;\n    for (y = 0; y < length; y++) {\n        memset(&s->qp_y_tab[x], lc->qp_y, length);\n        x += min_cb_width;\n    }\n    set_ct_depth(s, x0, y0, log2_cb_size, lc->ct.depth);\n    return 0;\n}', 'static void hls_transform_tree(HEVCContext *s, int x0, int y0,\n                               int xBase, int yBase, int cb_xBase, int cb_yBase,\n                               int log2_cb_size, int log2_trafo_size,\n                               int trafo_depth, int blk_idx)\n{\n    HEVCLocalContext *lc = &s->HEVClc;\n    uint8_t split_transform_flag;\n    if (trafo_depth > 0 && log2_trafo_size == 2) {\n        SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =\n            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth - 1], xBase, yBase);\n        SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) =\n            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase);\n    } else {\n        SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =\n        SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) = 0;\n    }\n    if (lc->cu.intra_split_flag) {\n        if (trafo_depth == 1)\n            lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[blk_idx];\n    } else {\n        lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[0];\n    }\n    lc->tt.cbf_luma = 1;\n    lc->tt.inter_split_flag = s->sps->max_transform_hierarchy_depth_inter == 0 &&\n                              lc->cu.pred_mode == MODE_INTER &&\n                              lc->cu.part_mode != PART_2Nx2N &&\n                              trafo_depth == 0;\n    if (log2_trafo_size <= s->sps->log2_max_trafo_size &&\n        log2_trafo_size >  s->sps->log2_min_tb_size    &&\n        trafo_depth     < lc->cu.max_trafo_depth       &&\n        !(lc->cu.intra_split_flag && trafo_depth == 0)) {\n        split_transform_flag = ff_hevc_split_transform_flag_decode(s, log2_trafo_size);\n    } else {\n        split_transform_flag = log2_trafo_size > s->sps->log2_max_trafo_size ||\n                               (lc->cu.intra_split_flag && trafo_depth == 0) ||\n                               lc->tt.inter_split_flag;\n    }\n    if (log2_trafo_size > 2) {\n        if (trafo_depth == 0 ||\n            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth - 1], xBase, yBase)) {\n            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) =\n                ff_hevc_cbf_cb_cr_decode(s, trafo_depth);\n        }\n        if (trafo_depth == 0 ||\n            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase)) {\n            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) =\n                ff_hevc_cbf_cb_cr_decode(s, trafo_depth);\n        }\n    }\n    if (split_transform_flag) {\n        int x1 = x0 + ((1 << log2_trafo_size) >> 1);\n        int y1 = y0 + ((1 << log2_trafo_size) >> 1);\n        hls_transform_tree(s, x0, y0, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\n                           log2_trafo_size - 1, trafo_depth + 1, 0);\n        hls_transform_tree(s, x1, y0, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\n                           log2_trafo_size - 1, trafo_depth + 1, 1);\n        hls_transform_tree(s, x0, y1, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\n                           log2_trafo_size - 1, trafo_depth + 1, 2);\n        hls_transform_tree(s, x1, y1, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\n                           log2_trafo_size - 1, trafo_depth + 1, 3);\n    } else {\n        int min_tu_size      = 1 << s->sps->log2_min_tb_size;\n        int log2_min_tu_size = s->sps->log2_min_tb_size;\n        int min_tu_width     = s->sps->min_tb_width;\n        if (lc->cu.pred_mode == MODE_INTRA || trafo_depth != 0 ||\n            SAMPLE_CBF(lc->tt.cbf_cb[trafo_depth], x0, y0) ||\n            SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0)) {\n            lc->tt.cbf_luma = ff_hevc_cbf_luma_decode(s, trafo_depth);\n        }\n        hls_transform_unit(s, x0, y0, xBase, yBase, cb_xBase, cb_yBase,\n                           log2_cb_size, log2_trafo_size, trafo_depth, blk_idx);\n        if (lc->tt.cbf_luma) {\n            int i, j;\n            for (i = 0; i < (1 << log2_trafo_size); i += min_tu_size)\n                for (j = 0; j < (1 << log2_trafo_size); j += min_tu_size) {\n                    int x_tu = (x0 + j) >> log2_min_tu_size;\n                    int y_tu = (y0 + i) >> log2_min_tu_size;\n                    s->cbf_luma[y_tu * min_tu_width + x_tu] = 1;\n                }\n        }\n        if (!s->sh.disable_deblocking_filter_flag) {\n            ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_trafo_size,\n                                                  lc->slice_or_tiles_up_boundary,\n                                                  lc->slice_or_tiles_left_boundary);\n            if (s->pps->transquant_bypass_enable_flag &&\n                lc->cu.cu_transquant_bypass_flag)\n                set_deblocking_bypass(s, x0, y0, log2_trafo_size);\n        }\n    }\n}']