libavcodec/proresenc.c:609: error: Buffer Overrun L1
  Offset: [64, `avctx->priv_data->num_planes` + 63] Size: 3 by call to `estimate_slice_plane`.

libavcodec/proresenc.c:556:1: Parameter `avctx->priv_data->num_planes`
554. }
555. 
556. static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic,
     ^
557.                             int trellis_node, int x, int y, int mbs_per_slice,
558.                             ProresThreadData *td)

libavcodec/proresenc.c:609:21: Call
607.         error = 0;
608.         for (i = 0; i < ctx->num_planes; i++) {
609.             bits += estimate_slice_plane(ctx, &error, i,
                         ^
610.                                          src, pic->linesize[i],
611.                                          mbs_per_slice,

libavcodec/proresenc.c:538:1: Parameter `plane`
  536. }
  537. 
  538. static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,
       ^
  539.                                 const uint16_t *src, int linesize,
  540.                                 int mbs_per_slice,

libavcodec/proresenc.c:549:13: Call
  547.     blocks_per_slice = mbs_per_slice * blocks_per_mb;
  548. 
  549.     bits  = estimate_dcs(error, td->blocks[plane], blocks_per_slice, qmat[0]);
                   ^
  550.     bits += estimate_acs(error, td->blocks[plane], blocks_per_slice,
  551.                          plane_size_factor, ctx->scantable.permutated, qmat);

libavcodec/proresenc.c:471:1: <Length trace>
469. }
470. 
471. static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,
     ^
472.                         int scale)
473. {

libavcodec/proresenc.c:471:1: Parameter `*blocks`
    469. }
    470. 
    471. static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,
         ^
    472.                         int scale)
    473. {

libavcodec/proresenc.c:482:5: Assignment
    480.     sign     = 0;
    481.     codebook = 3;
    482.     blocks  += 64;
             ^
    483.     *error  += FFABS(blocks[0] - 0x4000) % scale;
    484. 

libavcodec/proresenc.c:483:16: Array access: Offset: [64, avctx->priv_data->num_planes + 63] Size: 3 by call to `estimate_slice_plane` 
    481.     codebook = 3;
    482.     blocks  += 64;
    483.     *error  += FFABS(blocks[0] - 0x4000) % scale;
                        ^
    484. 
    485.     for (i = 1; i < blocks_per_slice; i++, blocks += 64) {

static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,
                        int scale)
{
    int i;
    int codebook = 3, code, dc, prev_dc, delta, sign, new_sign;
    int bits;
    prev_dc  = (blocks[0] - 0x4000) / scale;
    bits     = estimate_vlc(FIRST_DC_CB, MAKE_CODE(prev_dc));
    sign     = 0;
    codebook = 3;
    blocks  += 64;
    *error  += FFABS(blocks[0] - 0x4000) % scale;
    for (i = 1; i < blocks_per_slice; i++, blocks += 64) {
        dc       = (blocks[0] - 0x4000) / scale;
        *error  += FFABS(blocks[0] - 0x4000) % scale;
        delta    = dc - prev_dc;
        new_sign = GET_SIGN(delta);
        delta    = (delta ^ sign) - sign;
        code     = MAKE_CODE(delta);
        bits    += estimate_vlc(ff_prores_dc_codebook[codebook], code);
        codebook = (code + (code & 1)) >> 1;
        codebook = FFMIN(codebook, 3);
        sign     = new_sign;
        prev_dc  = dc;
    }
    return bits;
}
['static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic,\n                            int trellis_node, int x, int y, int mbs_per_slice,\n                            ProresThreadData *td)\n{\n    ProresContext *ctx = avctx->priv_data;\n    int i, q, pq, xp, yp;\n    const uint16_t *src;\n    int slice_width_factor = av_log2(mbs_per_slice);\n    int num_cblocks[MAX_PLANES], pwidth;\n    int plane_factor[MAX_PLANES], is_chroma[MAX_PLANES];\n    const int min_quant = ctx->profile_info->min_quant;\n    const int max_quant = ctx->profile_info->max_quant;\n    int error, bits, bits_limit;\n    int mbs, prev, cur, new_score;\n    int slice_bits[TRELLIS_WIDTH], slice_score[TRELLIS_WIDTH];\n    int overquant;\n    uint16_t *qmat;\n    mbs = x + mbs_per_slice;\n    for (i = 0; i < ctx->num_planes; i++) {\n        is_chroma[i]    = (i == 1 || i == 2);\n        plane_factor[i] = slice_width_factor + 2;\n        if (is_chroma[i])\n            plane_factor[i] += ctx->chroma_factor - 3;\n        if (!is_chroma[i] || ctx->chroma_factor == CFACTOR_Y444) {\n            xp             = x << 4;\n            yp             = y << 4;\n            num_cblocks[i] = 4;\n            pwidth         = avctx->width;\n        } else {\n            xp             = x << 3;\n            yp             = y << 4;\n            num_cblocks[i] = 2;\n            pwidth         = avctx->width >> 1;\n        }\n        src = (const uint16_t*)(pic->data[i] + yp * pic->linesize[i]) + xp;\n        get_slice_data(ctx, src, pic->linesize[i], xp, yp,\n                       pwidth, avctx->height, td->blocks[i], td->emu_buf,\n                       mbs_per_slice, num_cblocks[i], is_chroma[i]);\n    }\n    for (q = min_quant; q < max_quant + 2; q++) {\n        td->nodes[trellis_node + q].prev_node = -1;\n        td->nodes[trellis_node + q].quant     = q;\n    }\n    for (q = min_quant; q <= max_quant; q++) {\n        bits  = 0;\n        error = 0;\n        for (i = 0; i < ctx->num_planes; i++) {\n            bits += estimate_slice_plane(ctx, &error, i,\n                                         src, pic->linesize[i],\n                                         mbs_per_slice,\n                                         num_cblocks[i], plane_factor[i],\n                                         ctx->quants[q], td);\n        }\n        if (bits > 65000 * 8) {\n            error = SCORE_LIMIT;\n            break;\n        }\n        slice_bits[q]  = bits;\n        slice_score[q] = error;\n    }\n    if (slice_bits[max_quant] <= ctx->bits_per_mb * mbs_per_slice) {\n        slice_bits[max_quant + 1]  = slice_bits[max_quant];\n        slice_score[max_quant + 1] = slice_score[max_quant] + 1;\n        overquant = max_quant;\n    } else {\n        for (q = max_quant + 1; q < 128; q++) {\n            bits  = 0;\n            error = 0;\n            if (q < MAX_STORED_Q) {\n                qmat = ctx->quants[q];\n            } else {\n                qmat = td->custom_q;\n                for (i = 0; i < 64; i++)\n                    qmat[i] = ctx->quant_mat[i] * q;\n            }\n            for (i = 0; i < ctx->num_planes; i++) {\n                bits += estimate_slice_plane(ctx, &error, i,\n                                             src, pic->linesize[i],\n                                             mbs_per_slice,\n                                             num_cblocks[i], plane_factor[i],\n                                             qmat, td);\n            }\n            if (bits <= ctx->bits_per_mb * mbs_per_slice)\n                break;\n        }\n        slice_bits[max_quant + 1]  = bits;\n        slice_score[max_quant + 1] = error;\n        overquant = q;\n    }\n    td->nodes[trellis_node + max_quant + 1].quant = overquant;\n    bits_limit = mbs * ctx->bits_per_mb;\n    for (pq = min_quant; pq < max_quant + 2; pq++) {\n        prev = trellis_node - TRELLIS_WIDTH + pq;\n        for (q = min_quant; q < max_quant + 2; q++) {\n            cur = trellis_node + q;\n            bits  = td->nodes[prev].bits + slice_bits[q];\n            error = slice_score[q];\n            if (bits > bits_limit)\n                error = SCORE_LIMIT;\n            if (td->nodes[prev].score < SCORE_LIMIT && error < SCORE_LIMIT)\n                new_score = td->nodes[prev].score + error;\n            else\n                new_score = SCORE_LIMIT;\n            if (td->nodes[cur].prev_node == -1 ||\n                td->nodes[cur].score >= new_score) {\n                td->nodes[cur].bits      = bits;\n                td->nodes[cur].score     = new_score;\n                td->nodes[cur].prev_node = prev;\n            }\n        }\n    }\n    error = td->nodes[trellis_node + min_quant].score;\n    pq    = trellis_node + min_quant;\n    for (q = min_quant + 1; q < max_quant + 2; q++) {\n        if (td->nodes[trellis_node + q].score <= error) {\n            error = td->nodes[trellis_node + q].score;\n            pq    = trellis_node + q;\n        }\n    }\n    return pq;\n}', 'static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,\n                                const uint16_t *src, int linesize,\n                                int mbs_per_slice,\n                                int blocks_per_mb, int plane_size_factor,\n                                const int16_t *qmat, ProresThreadData *td)\n{\n    int blocks_per_slice;\n    int bits;\n    blocks_per_slice = mbs_per_slice * blocks_per_mb;\n    bits  = estimate_dcs(error, td->blocks[plane], blocks_per_slice, qmat[0]);\n    bits += estimate_acs(error, td->blocks[plane], blocks_per_slice,\n                         plane_size_factor, ctx->scantable.permutated, qmat);\n    return FFALIGN(bits, 8);\n}', 'static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,\n                        int scale)\n{\n    int i;\n    int codebook = 3, code, dc, prev_dc, delta, sign, new_sign;\n    int bits;\n    prev_dc  = (blocks[0] - 0x4000) / scale;\n    bits     = estimate_vlc(FIRST_DC_CB, MAKE_CODE(prev_dc));\n    sign     = 0;\n    codebook = 3;\n    blocks  += 64;\n    *error  += FFABS(blocks[0] - 0x4000) % scale;\n    for (i = 1; i < blocks_per_slice; i++, blocks += 64) {\n        dc       = (blocks[0] - 0x4000) / scale;\n        *error  += FFABS(blocks[0] - 0x4000) % scale;\n        delta    = dc - prev_dc;\n        new_sign = GET_SIGN(delta);\n        delta    = (delta ^ sign) - sign;\n        code     = MAKE_CODE(delta);\n        bits    += estimate_vlc(ff_prores_dc_codebook[codebook], code);\n        codebook = (code + (code & 1)) >> 1;\n        codebook = FFMIN(codebook, 3);\n        sign     = new_sign;\n        prev_dc  = dc;\n    }\n    return bits;\n}']