libavcodec/h264.c:1657: error: Buffer Overrun L3
  Offset added: 60 Size: [0, +oo].

libavcodec/h264.c:1471:1: <Length trace>
1469.  * ff_thread_finish_setup()
1470.  */
1471. static void decode_postinit(H264Context *h, int setup_finished)
      ^
1472. {
1473.     MpegEncContext *const s = &h->s;

libavcodec/h264.c:1471:1: Parameter `h->last_pocs[*]`
1469.  * ff_thread_finish_setup()
1470.  */
1471. static void decode_postinit(H264Context *h, int setup_finished)
      ^
1472. {
1473.     MpegEncContext *const s = &h->s;

libavcodec/h264.c:1657:5: Array access: Offset added: 60 Size: [0, +oo]
1655.             h->delayed_pic[i] = h->delayed_pic[i + 1];
1656.     }
1657.     memmove(h->last_pocs, &h->last_pocs[1],
          ^
1658.             sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
1659.     h->last_pocs[MAX_DELAYED_PIC_COUNT - 1] = cur->poc;

static void decode_postinit(H264Context *h, int setup_finished)
{
    MpegEncContext *const s = &h->s;
    Picture *out = s->current_picture_ptr;
    Picture *cur = s->current_picture_ptr;
    int i, pics, out_of_order, out_idx;
    int invalid = 0, cnt = 0;
    s->current_picture_ptr->f.qscale_type = FF_QSCALE_TYPE_H264;
    s->current_picture_ptr->f.pict_type   = s->pict_type;
    if (h->next_output_pic)
        return;
    if (cur->field_poc[0] == INT_MAX || cur->field_poc[1] == INT_MAX) {
        return;
    }
    cur->f.interlaced_frame = 0;
    cur->f.repeat_pict      = 0;
    if (h->sps.pic_struct_present_flag) {
        switch (h->sei_pic_struct) {
        case SEI_PIC_STRUCT_FRAME:
            break;
        case SEI_PIC_STRUCT_TOP_FIELD:
        case SEI_PIC_STRUCT_BOTTOM_FIELD:
            cur->f.interlaced_frame = 1;
            break;
        case SEI_PIC_STRUCT_TOP_BOTTOM:
        case SEI_PIC_STRUCT_BOTTOM_TOP:
            if (FIELD_OR_MBAFF_PICTURE)
                cur->f.interlaced_frame = 1;
            else
                cur->f.interlaced_frame = h->prev_interlaced_frame;
            break;
        case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
        case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
            cur->f.repeat_pict = 1;
            break;
        case SEI_PIC_STRUCT_FRAME_DOUBLING:
            cur->f.repeat_pict = 2;
            break;
        case SEI_PIC_STRUCT_FRAME_TRIPLING:
            cur->f.repeat_pict = 4;
            break;
        }
        if ((h->sei_ct_type & 3) &&
            h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
            cur->f.interlaced_frame = (h->sei_ct_type & (1 << 1)) != 0;
    } else {
        cur->f.interlaced_frame = FIELD_OR_MBAFF_PICTURE;
    }
    h->prev_interlaced_frame = cur->f.interlaced_frame;
    if (cur->field_poc[0] != cur->field_poc[1]) {
        cur->f.top_field_first = cur->field_poc[0] < cur->field_poc[1];
    } else {
        if (cur->f.interlaced_frame || h->sps.pic_struct_present_flag) {
            if (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||
                h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
                cur->f.top_field_first = 1;
            else
                cur->f.top_field_first = 0;
        } else {
            cur->f.top_field_first = 0;
        }
    }
    if (h->sps.bitstream_restriction_flag &&
        s->avctx->has_b_frames < h->sps.num_reorder_frames) {
        s->avctx->has_b_frames = h->sps.num_reorder_frames;
        s->low_delay           = 0;
    }
    if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT &&
        !h->sps.bitstream_restriction_flag) {
        s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1;
        s->low_delay           = 0;
    }
    pics = 0;
    while (h->delayed_pic[pics])
        pics++;
    assert(pics <= MAX_DELAYED_PIC_COUNT);
    h->delayed_pic[pics++] = cur;
    if (cur->f.reference == 0)
        cur->f.reference = DELAYED_PIC_REF;
    for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) {
        cnt     += out->poc < h->last_pocs[i];
        invalid += out->poc == INT_MIN;
    }
    if (!h->mmco_reset && !cur->f.key_frame &&
        cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {
        h->mmco_reset = 2;
        if (pics > 1)
            h->delayed_pic[pics - 2]->mmco_reset = 2;
    }
    if (h->mmco_reset || cur->f.key_frame) {
        for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
            h->last_pocs[i] = INT_MIN;
        cnt     = 0;
        invalid = MAX_DELAYED_PIC_COUNT;
    }
    out     = h->delayed_pic[0];
    out_idx = 0;
    for (i = 1; i < MAX_DELAYED_PIC_COUNT &&
                h->delayed_pic[i] &&
                !h->delayed_pic[i - 1]->mmco_reset &&
                !h->delayed_pic[i]->f.key_frame;
         i++)
        if (h->delayed_pic[i]->poc < out->poc) {
            out     = h->delayed_pic[i];
            out_idx = i;
        }
    if (s->avctx->has_b_frames == 0 &&
        (h->delayed_pic[0]->f.key_frame || h->mmco_reset))
        h->next_outputed_poc = INT_MIN;
    out_of_order = !out->f.key_frame && !h->mmco_reset &&
                   (out->poc < h->next_outputed_poc);
    if (h->sps.bitstream_restriction_flag &&
        s->avctx->has_b_frames >= h->sps.num_reorder_frames) {
    } else if (out_of_order && pics - 1 == s->avctx->has_b_frames &&
               s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) {
        if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {
            s->avctx->has_b_frames = FFMAX(s->avctx->has_b_frames, cnt);
        }
        s->low_delay = 0;
    } else if (s->low_delay &&
               ((h->next_outputed_poc != INT_MIN &&
                 out->poc > h->next_outputed_poc + 2) ||
                cur->f.pict_type == AV_PICTURE_TYPE_B)) {
        s->low_delay = 0;
        s->avctx->has_b_frames++;
    }
    if (pics > s->avctx->has_b_frames) {
        out->f.reference &= ~DELAYED_PIC_REF;
        out->owner2       = s;
        for (i = out_idx; h->delayed_pic[i]; i++)
            h->delayed_pic[i] = h->delayed_pic[i + 1];
    }
    memmove(h->last_pocs, &h->last_pocs[1],
            sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
    h->last_pocs[MAX_DELAYED_PIC_COUNT - 1] = cur->poc;
    if (!out_of_order && pics > s->avctx->has_b_frames) {
        h->next_output_pic = out;
        if (out->mmco_reset) {
            if (out_idx > 0) {
                h->next_outputed_poc                    = out->poc;
                h->delayed_pic[out_idx - 1]->mmco_reset = out->mmco_reset;
            } else {
                h->next_outputed_poc = INT_MIN;
            }
        } else {
            if (out_idx == 0 && pics > 1 && h->delayed_pic[0]->f.key_frame) {
                h->next_outputed_poc = INT_MIN;
            } else {
                h->next_outputed_poc = out->poc;
            }
        }
        h->mmco_reset = 0;
    } else {
        av_log(s->avctx, AV_LOG_DEBUG, "no picture\n");
    }
    if (setup_finished)
        ff_thread_finish_setup(s->avctx);
}
['static void decode_postinit(H264Context *h, int setup_finished)\n{\n    MpegEncContext *const s = &h->s;\n    Picture *out = s->current_picture_ptr;\n    Picture *cur = s->current_picture_ptr;\n    int i, pics, out_of_order, out_idx;\n    int invalid = 0, cnt = 0;\n    s->current_picture_ptr->f.qscale_type = FF_QSCALE_TYPE_H264;\n    s->current_picture_ptr->f.pict_type   = s->pict_type;\n    if (h->next_output_pic)\n        return;\n    if (cur->field_poc[0] == INT_MAX || cur->field_poc[1] == INT_MAX) {\n        return;\n    }\n    cur->f.interlaced_frame = 0;\n    cur->f.repeat_pict      = 0;\n    if (h->sps.pic_struct_present_flag) {\n        switch (h->sei_pic_struct) {\n        case SEI_PIC_STRUCT_FRAME:\n            break;\n        case SEI_PIC_STRUCT_TOP_FIELD:\n        case SEI_PIC_STRUCT_BOTTOM_FIELD:\n            cur->f.interlaced_frame = 1;\n            break;\n        case SEI_PIC_STRUCT_TOP_BOTTOM:\n        case SEI_PIC_STRUCT_BOTTOM_TOP:\n            if (FIELD_OR_MBAFF_PICTURE)\n                cur->f.interlaced_frame = 1;\n            else\n                cur->f.interlaced_frame = h->prev_interlaced_frame;\n            break;\n        case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:\n        case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:\n            cur->f.repeat_pict = 1;\n            break;\n        case SEI_PIC_STRUCT_FRAME_DOUBLING:\n            cur->f.repeat_pict = 2;\n            break;\n        case SEI_PIC_STRUCT_FRAME_TRIPLING:\n            cur->f.repeat_pict = 4;\n            break;\n        }\n        if ((h->sei_ct_type & 3) &&\n            h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)\n            cur->f.interlaced_frame = (h->sei_ct_type & (1 << 1)) != 0;\n    } else {\n        cur->f.interlaced_frame = FIELD_OR_MBAFF_PICTURE;\n    }\n    h->prev_interlaced_frame = cur->f.interlaced_frame;\n    if (cur->field_poc[0] != cur->field_poc[1]) {\n        cur->f.top_field_first = cur->field_poc[0] < cur->field_poc[1];\n    } else {\n        if (cur->f.interlaced_frame || h->sps.pic_struct_present_flag) {\n            if (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||\n                h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)\n                cur->f.top_field_first = 1;\n            else\n                cur->f.top_field_first = 0;\n        } else {\n            cur->f.top_field_first = 0;\n        }\n    }\n    if (h->sps.bitstream_restriction_flag &&\n        s->avctx->has_b_frames < h->sps.num_reorder_frames) {\n        s->avctx->has_b_frames = h->sps.num_reorder_frames;\n        s->low_delay           = 0;\n    }\n    if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT &&\n        !h->sps.bitstream_restriction_flag) {\n        s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1;\n        s->low_delay           = 0;\n    }\n    pics = 0;\n    while (h->delayed_pic[pics])\n        pics++;\n    assert(pics <= MAX_DELAYED_PIC_COUNT);\n    h->delayed_pic[pics++] = cur;\n    if (cur->f.reference == 0)\n        cur->f.reference = DELAYED_PIC_REF;\n    for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) {\n        cnt     += out->poc < h->last_pocs[i];\n        invalid += out->poc == INT_MIN;\n    }\n    if (!h->mmco_reset && !cur->f.key_frame &&\n        cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {\n        h->mmco_reset = 2;\n        if (pics > 1)\n            h->delayed_pic[pics - 2]->mmco_reset = 2;\n    }\n    if (h->mmco_reset || cur->f.key_frame) {\n        for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)\n            h->last_pocs[i] = INT_MIN;\n        cnt     = 0;\n        invalid = MAX_DELAYED_PIC_COUNT;\n    }\n    out     = h->delayed_pic[0];\n    out_idx = 0;\n    for (i = 1; i < MAX_DELAYED_PIC_COUNT &&\n                h->delayed_pic[i] &&\n                !h->delayed_pic[i - 1]->mmco_reset &&\n                !h->delayed_pic[i]->f.key_frame;\n         i++)\n        if (h->delayed_pic[i]->poc < out->poc) {\n            out     = h->delayed_pic[i];\n            out_idx = i;\n        }\n    if (s->avctx->has_b_frames == 0 &&\n        (h->delayed_pic[0]->f.key_frame || h->mmco_reset))\n        h->next_outputed_poc = INT_MIN;\n    out_of_order = !out->f.key_frame && !h->mmco_reset &&\n                   (out->poc < h->next_outputed_poc);\n    if (h->sps.bitstream_restriction_flag &&\n        s->avctx->has_b_frames >= h->sps.num_reorder_frames) {\n    } else if (out_of_order && pics - 1 == s->avctx->has_b_frames &&\n               s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) {\n        if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {\n            s->avctx->has_b_frames = FFMAX(s->avctx->has_b_frames, cnt);\n        }\n        s->low_delay = 0;\n    } else if (s->low_delay &&\n               ((h->next_outputed_poc != INT_MIN &&\n                 out->poc > h->next_outputed_poc + 2) ||\n                cur->f.pict_type == AV_PICTURE_TYPE_B)) {\n        s->low_delay = 0;\n        s->avctx->has_b_frames++;\n    }\n    if (pics > s->avctx->has_b_frames) {\n        out->f.reference &= ~DELAYED_PIC_REF;\n        out->owner2       = s;\n        for (i = out_idx; h->delayed_pic[i]; i++)\n            h->delayed_pic[i] = h->delayed_pic[i + 1];\n    }\n    memmove(h->last_pocs, &h->last_pocs[1],\n            sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));\n    h->last_pocs[MAX_DELAYED_PIC_COUNT - 1] = cur->poc;\n    if (!out_of_order && pics > s->avctx->has_b_frames) {\n        h->next_output_pic = out;\n        if (out->mmco_reset) {\n            if (out_idx > 0) {\n                h->next_outputed_poc                    = out->poc;\n                h->delayed_pic[out_idx - 1]->mmco_reset = out->mmco_reset;\n            } else {\n                h->next_outputed_poc = INT_MIN;\n            }\n        } else {\n            if (out_idx == 0 && pics > 1 && h->delayed_pic[0]->f.key_frame) {\n                h->next_outputed_poc = INT_MIN;\n            } else {\n                h->next_outputed_poc = out->poc;\n            }\n        }\n        h->mmco_reset = 0;\n    } else {\n        av_log(s->avctx, AV_LOG_DEBUG, "no picture\\n");\n    }\n    if (setup_finished)\n        ff_thread_finish_setup(s->avctx);\n}']