libavcodec/proresenc.c:821: error: Buffer Overrun L1
  Offset: [4, +oo] (⇐ 3 + [1, +oo]) Size: 4 by call to `estimate_alpha_plane`.

libavcodec/proresenc.c:746:1: Parameter `td->blocks[*]`
744. }
745. 
746. static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic,
     ^
747.                             int trellis_node, int x, int y, int mbs_per_slice,
748.                             ProresThreadData *td)

libavcodec/proresenc.c:821:21: Call
819.         }
820.         if (ctx->alpha_bits)
821.             bits += estimate_alpha_plane(ctx, &error, src, linesize[3],
                         ^
822.                                          mbs_per_slice, q, td->blocks[3]);
823.         if (bits > 65000 * 8)

libavcodec/proresenc.c:716:18: <Offset trace>
714. 
715.     *error = 0;
716.     cur = blocks[idx++];
                      ^
717.     bits = est_alpha_diff(cur, prev, abits);
718.     prev = cur;

libavcodec/proresenc.c:716:18: Assignment
  714. 
  715.     *error = 0;
  716.     cur = blocks[idx++];
                        ^
  717.     bits = est_alpha_diff(cur, prev, abits);
  718.     prev = cur;

libavcodec/proresenc.c:702:1: <Length trace>
700. }
701. 
702. static int estimate_alpha_plane(ProresContext *ctx, int *error,
     ^
703.                                 const uint16_t *src, int linesize,
704.                                 int mbs_per_slice, int quant,

libavcodec/proresenc.c:702:1: Parameter `*blocks`
  700. }
  701. 
  702. static int estimate_alpha_plane(ProresContext *ctx, int *error,
       ^
  703.                                 const uint16_t *src, int linesize,
  704.                                 int mbs_per_slice, int quant,

libavcodec/proresenc.c:720:15: Array access: Offset: [4, +oo] (⇐ 3 + [1, +oo]) Size: 4 by call to `estimate_alpha_plane` 
  718.     prev = cur;
  719.     do {
  720.         cur = blocks[idx++];
                     ^
  721.         if (cur != prev) {
  722.             if (!run)

static int estimate_alpha_plane(ProresContext *ctx, int *error,
                                const uint16_t *src, int linesize,
                                int mbs_per_slice, int quant,
                                int16_t *blocks)
{
    const int abits = ctx->alpha_bits;
    const int mask  = (1 << abits) - 1;
    const int num_coeffs = mbs_per_slice * 256;
    int prev = mask, cur;
    int idx = 0;
    int run = 0;
    int bits;
    *error = 0;
    cur = blocks[idx++];
    bits = est_alpha_diff(cur, prev, abits);
    prev = cur;
    do {
        cur = blocks[idx++];
        if (cur != prev) {
            if (!run)
                bits++;
            else if (run < 0x10)
                bits += 4;
            else
                bits += 15;
            bits += est_alpha_diff(cur, prev, abits);
            prev = cur;
            run  = 0;
        } else {
            run++;
        }
    } while (idx < num_coeffs);
    if (run) {
        if (run < 0x10)
            bits += 4;
        else
            bits += 15;
    }
    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    int linesize[4], line_add;\n    if (ctx->pictures_per_frame == 1)\n        line_add = 0;\n    else\n        line_add = ctx->cur_picture_idx ^ !pic->top_field_first;\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        linesize[i] = pic->linesize[i] * ctx->pictures_per_frame;\n        src = (const uint16_t*)(pic->data[i] + yp * linesize[i] +\n                                line_add * pic->linesize[i]) + xp;\n        if (i < 3) {\n            get_slice_data(ctx, src, linesize[i], xp, yp,\n                           pwidth, avctx->height / ctx->pictures_per_frame,\n                           td->blocks[i], td->emu_buf,\n                           mbs_per_slice, num_cblocks[i], is_chroma[i]);\n        } else {\n            get_alpha_data(ctx, src, linesize[i], xp, yp,\n                           pwidth, avctx->height / ctx->pictures_per_frame,\n                           td->blocks[i], mbs_per_slice, ctx->alpha_bits);\n        }\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 - !!ctx->alpha_bits; i++) {\n            bits += estimate_slice_plane(ctx, &error, i,\n                                         src, linesize[i],\n                                         mbs_per_slice,\n                                         num_cblocks[i], plane_factor[i],\n                                         ctx->quants[q], td);\n        }\n        if (ctx->alpha_bits)\n            bits += estimate_alpha_plane(ctx, &error, src, linesize[3],\n                                         mbs_per_slice, q, td->blocks[3]);\n        if (bits > 65000 * 8)\n            error = SCORE_LIMIT;\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 - !!ctx->alpha_bits; i++) {\n                bits += estimate_slice_plane(ctx, &error, i,\n                                             src, linesize[i],\n                                             mbs_per_slice,\n                                             num_cblocks[i], plane_factor[i],\n                                             qmat, td);\n            }\n            if (ctx->alpha_bits)\n                bits += estimate_alpha_plane(ctx, &error, src, linesize[3],\n                                             mbs_per_slice, q, td->blocks[3]);\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_alpha_plane(ProresContext *ctx, int *error,\n                                const uint16_t *src, int linesize,\n                                int mbs_per_slice, int quant,\n                                int16_t *blocks)\n{\n    const int abits = ctx->alpha_bits;\n    const int mask  = (1 << abits) - 1;\n    const int num_coeffs = mbs_per_slice * 256;\n    int prev = mask, cur;\n    int idx = 0;\n    int run = 0;\n    int bits;\n    *error = 0;\n    cur = blocks[idx++];\n    bits = est_alpha_diff(cur, prev, abits);\n    prev = cur;\n    do {\n        cur = blocks[idx++];\n        if (cur != prev) {\n            if (!run)\n                bits++;\n            else if (run < 0x10)\n                bits += 4;\n            else\n                bits += 15;\n            bits += est_alpha_diff(cur, prev, abits);\n            prev = cur;\n            run  = 0;\n        } else {\n            run++;\n        }\n    } while (idx < num_coeffs);\n    if (run) {\n        if (run < 0x10)\n            bits += 4;\n        else\n            bits += 15;\n    }\n    return bits;\n}']