libavcodec/h261dec.c:567: error: Buffer Overrun L2
  Offset: [0, 1001] Size: 61 by call to `MPV_common_init`.

libavcodec/h261dec.c:577:11: Call
575.     }
576. 
577.     ret = h261_decode_picture_header(h);
               ^
578. 
579.     /* skip if the header was thrashed */

libavcodec/h261dec.c:465:38: Assignment
  463.     s->picture_number = (s->picture_number&~31) + i;
  464. 
  465.     s->avctx->time_base= (AVRational){1001, 30000};
                                            ^
  466.     s->current_picture.pts= s->picture_number;
  467. 

libavcodec/h261dec.c:567:13: Call
565. 
566.     if(!s->context_initialized){
567.         if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
                 ^
568.             return -1;
569.     }

libavcodec/mpegvideo.c:443:9: Parameter `s->avctx->pix_fmt`
  441.  * this assumes that some variables like width/height are already set
  442.  */
  443. av_cold int MPV_common_init(MpegEncContext *s)
               ^
  444. {
  445.     int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;

libavcodec/mpegvideo.c:479:5: Call
  477. 
  478.     /* set chroma shifts */
  479.     avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),
           ^
  480.                                                     &(s->chroma_y_shift) );
  481. 

libavcodec/imgconvert.c:532:1: <Offset trace>
530. };
531. 
532. void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
     ^
533. {
534.     *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;

libavcodec/imgconvert.c:532:1: Parameter `pix_fmt`
    530. };
    531. 
    532. void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
         ^
    533. {
    534.     *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;

libavcodec/imgconvert.c:67:1: <Length trace>
65. 
66. /* this table gives more information about formats */
67. static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
    ^
68.     /* YUV formats */
69.     [PIX_FMT_YUV420P] = {

libavcodec/imgconvert.c:67:1: Array declaration
    65. 
    66. /* this table gives more information about formats */
    67. static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
        ^
    68.     /* YUV formats */
    69.     [PIX_FMT_YUV420P] = {

libavcodec/imgconvert.c:534:16: Array access: Offset: [0, 1001] Size: 61 by call to `MPV_common_init` 
    532. void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
    533. {
    534.     *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;
                        ^
    535.     *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;
    536. }

void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
{
    *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;
    *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;
}
['static int h261_decode_frame(AVCodecContext *avctx,\n                             void *data, int *data_size,\n                             AVPacket *avpkt)\n{\n    const uint8_t *buf = avpkt->data;\n    int buf_size = avpkt->size;\n    H261Context *h= avctx->priv_data;\n    MpegEncContext *s = &h->s;\n    int ret;\n    AVFrame *pict = data;\n    dprintf(avctx, "*****frame %d size=%d\\n", avctx->frame_number, buf_size);\n    dprintf(avctx, "bytes=%x %x %x %x\\n", buf[0], buf[1], buf[2], buf[3]);\n    s->flags= avctx->flags;\n    s->flags2= avctx->flags2;\n    h->gob_start_code_skipped=0;\nretry:\n    init_get_bits(&s->gb, buf, buf_size*8);\n    if(!s->context_initialized){\n        if (MPV_common_init(s) < 0)\n            return -1;\n    }\n    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){\n        int i= ff_find_unused_picture(s, 0);\n        s->current_picture_ptr= &s->picture[i];\n    }\n    ret = h261_decode_picture_header(h);\n    if (ret < 0){\n        av_log(s->avctx, AV_LOG_ERROR, "header damaged\\n");\n        return -1;\n    }\n    if (s->width != avctx->coded_width || s->height != avctx->coded_height){\n        ParseContext pc= s->parse_context;\n        s->parse_context.buffer=0;\n        MPV_common_end(s);\n        s->parse_context= pc;\n    }\n    if (!s->context_initialized) {\n        avcodec_set_dimensions(avctx, s->width, s->height);\n        goto retry;\n    }\n    s->current_picture.pict_type= s->pict_type;\n    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;\n    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);\n    if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)\n       ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)\n       || avctx->skip_frame >= AVDISCARD_ALL)\n        return get_consumed_bytes(s, buf_size);\n    if(MPV_frame_start(s, avctx) < 0)\n        return -1;\n    ff_er_frame_start(s);\n    s->mb_x=0;\n    s->mb_y=0;\n    while(h->gob_number < (s->mb_height==18 ? 12 : 5)){\n        if(ff_h261_resync(h)<0)\n            break;\n        h261_decode_gob(h);\n    }\n    MPV_frame_end(s);\nassert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);\nassert(s->current_picture.pict_type == s->pict_type);\n    *pict= *(AVFrame*)s->current_picture_ptr;\n    ff_print_debug_info(s, pict);\n    *data_size = sizeof(AVFrame);\n    return get_consumed_bytes(s, buf_size);\n}', 'static int h261_decode_picture_header(H261Context *h){\n    MpegEncContext * const s = &h->s;\n    int format, i;\n    uint32_t startcode= 0;\n    for(i= get_bits_left(&s->gb); i>24; i-=1){\n        startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;\n        if(startcode == 0x10)\n            break;\n    }\n    if (startcode != 0x10){\n        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\\n");\n        return -1;\n    }\n    i= get_bits(&s->gb, 5);\n    if(i < (s->picture_number&31))\n        i += 32;\n    s->picture_number = (s->picture_number&~31) + i;\n    s->avctx->time_base= (AVRational){1001, 30000};\n    s->current_picture.pts= s->picture_number;\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    format = get_bits1(&s->gb);\n    if (format == 0){\n        s->width = 176;\n        s->height = 144;\n        s->mb_width = 11;\n        s->mb_height = 9;\n    }else{\n        s->width = 352;\n        s->height = 288;\n        s->mb_width = 22;\n        s->mb_height = 18;\n    }\n    s->mb_num = s->mb_width * s->mb_height;\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    while (get_bits1(&s->gb) != 0){\n        skip_bits(&s->gb, 8);\n    }\n    s->pict_type = FF_P_TYPE;\n    h->gob_number = 0;\n    return 0;\n}', 'int MPV_common_init(MpegEncContext *s)\n{\n    int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;\n    if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)\n        s->mb_height = (s->height + 31) / 32 * 2;\n    else\n        s->mb_height = (s->height + 15) / 16;\n    if(s->avctx->pix_fmt == PIX_FMT_NONE){\n        av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supported.\\n");\n        return -1;\n    }\n    if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){\n        av_log(s->avctx, AV_LOG_ERROR, "too many threads\\n");\n        return -1;\n    }\n    if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))\n        return -1;\n    dsputil_init(&s->dsp, s->avctx);\n    ff_dct_common_init(s);\n    s->flags= s->avctx->flags;\n    s->flags2= s->avctx->flags2;\n    s->mb_width  = (s->width  + 15) / 16;\n    s->mb_stride = s->mb_width + 1;\n    s->b8_stride = s->mb_width*2 + 1;\n    s->b4_stride = s->mb_width*4 + 1;\n    mb_array_size= s->mb_height * s->mb_stride;\n    mv_table_size= (s->mb_height+2) * s->mb_stride + 1;\n    avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),\n                                                    &(s->chroma_y_shift) );\n    s->h_edge_pos= s->mb_width*16;\n    s->v_edge_pos= s->mb_height*16;\n    s->mb_num = s->mb_width * s->mb_height;\n    s->block_wrap[0]=\n    s->block_wrap[1]=\n    s->block_wrap[2]=\n    s->block_wrap[3]= s->b8_stride;\n    s->block_wrap[4]=\n    s->block_wrap[5]= s->mb_stride;\n    y_size = s->b8_stride * (2 * s->mb_height + 1);\n    c_size = s->mb_stride * (s->mb_height + 1);\n    yc_size = y_size + 2 * c_size;\n    s->codec_tag=          toupper( s->avctx->codec_tag     &0xFF)\n                        + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )\n                        + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)\n                        + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);\n    s->stream_codec_tag=          toupper( s->avctx->stream_codec_tag     &0xFF)\n                               + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )\n                               + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)\n                               + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);\n    s->avctx->coded_frame= (AVFrame*)&s->current_picture;\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail)\n    for(y=0; y<s->mb_height; y++){\n        for(x=0; x<s->mb_width; x++){\n            s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;\n        }\n    }\n    s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width;\n    if (s->encoding) {\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base            , mv_table_size * 2 * sizeof(int16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base       , mv_table_size * 2 * sizeof(int16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base       , mv_table_size * 2 * sizeof(int16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base     , mv_table_size * 2 * sizeof(int16_t), fail)\n        s->p_mv_table           = s->p_mv_table_base            + s->mb_stride + 1;\n        s->b_forw_mv_table      = s->b_forw_mv_table_base       + s->mb_stride + 1;\n        s->b_back_mv_table      = s->b_back_mv_table_base       + s->mb_stride + 1;\n        s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;\n        s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;\n        s->b_direct_mv_table    = s->b_direct_mv_table_base     + s->mb_stride + 1;\n        if(s->msmpeg4_version){\n            FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail);\n        }\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type  , mb_array_size * sizeof(uint16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix  , 64*32   * sizeof(int), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix  , 64*32   * sizeof(int), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)\n        if(s->avctx->noise_reduction){\n            FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail)\n        }\n    }\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail)\n    for(i = 0; i < MAX_PICTURE_COUNT; i++) {\n        avcodec_get_frame_defaults((AVFrame *)&s->picture[i]);\n    }\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, mb_array_size*sizeof(uint8_t), fail)\n    if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){\n            for(i=0; i<2; i++){\n                int j, k;\n                for(j=0; j<2; j++){\n                    for(k=0; k<2; k++){\n                        FF_ALLOCZ_OR_GOTO(s->avctx,    s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail)\n                        s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1;\n                    }\n                    FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail)\n                    FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail)\n                    s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]+ s->mb_stride + 1;\n                }\n                FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail)\n            }\n    }\n    if (s->out_format == FMT_H263) {\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail);\n        s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;\n        s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;\n        s->ac_val[2] = s->ac_val[1] + c_size;\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);\n        s->coded_block= s->coded_block_base + s->b8_stride + 1;\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table     , mb_array_size * sizeof(uint8_t), fail)\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail)\n    }\n    if (s->h263_pred || s->h263_plus || !s->encoding) {\n        FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail);\n        s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;\n        s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;\n        s->dc_val[2] = s->dc_val[1] + c_size;\n        for(i=0;i<yc_size;i++)\n            s->dc_val_base[i] = 1024;\n    }\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);\n    memset(s->mbintra_table, 1, mb_array_size);\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size+2, fail);\n    FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail);\n    s->parse_context.state= -1;\n    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){\n       s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);\n       s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);\n       s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);\n    }\n    s->context_initialized = 1;\n    s->thread_context[0]= s;\n    threads = s->avctx->thread_count;\n    for(i=1; i<threads; i++){\n        s->thread_context[i]= av_malloc(sizeof(MpegEncContext));\n        memcpy(s->thread_context[i], s, sizeof(MpegEncContext));\n    }\n    for(i=0; i<threads; i++){\n        if(init_duplicate_context(s->thread_context[i], s) < 0)\n           goto fail;\n        s->thread_context[i]->start_mb_y= (s->mb_height*(i  ) + s->avctx->thread_count/2) / s->avctx->thread_count;\n        s->thread_context[i]->end_mb_y  = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;\n    }\n    return 0;\n fail:\n    MPV_common_end(s);\n    return -1;\n}', 'void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)\n{\n    *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;\n    *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;\n}']