libavcodec/mpegvideo_parser.c:52: error: Integer Overflow L1
  ([1099511627520, +oo] + `*buf`):unsigned32 by call to `avpriv_find_start_code`.

libavcodec/mpegvideo_parser.c:35:1: Parameter `*buf`
33. 
34. 
35. static void mpegvideo_extract_headers(AVCodecParserContext *s,
    ^
36.                                       AVCodecContext *avctx,
37.                                       const uint8_t *buf, int buf_size)

libavcodec/mpegvideo_parser.c:52:14: Call
50.     while (buf < buf_end) {
51.         start_code= -1;
52.         buf= avpriv_find_start_code(buf, buf_end, &start_code);
                 ^
53.         bytes_left = buf_end - buf;
54.         switch(start_code) {

libavcodec/utils.c:2201:1: <LHS trace>
2199. }
2200. 
2201. const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
      ^
2202.                                       const uint8_t *end,
2203.                                       uint32_t * restrict state)

libavcodec/utils.c:2201:1: Parameter `*state`
  2199. }
  2200. 
  2201. const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
        ^
  2202.                                       const uint8_t *end,
  2203.                                       uint32_t * restrict state)

libavcodec/utils.c:2212:9: Assignment
  2210. 
  2211.     for (i = 0; i < 3; i++) {
  2212.         uint32_t tmp = *state << 8;
                ^
  2213.         *state = tmp + *(p++);
  2214.         if (tmp == 0x100 || p == end)

libavcodec/utils.c:2201:1: <RHS trace>
2199. }
2200. 
2201. const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
      ^
2202.                                       const uint8_t *end,
2203.                                       uint32_t * restrict state)

libavcodec/utils.c:2201:1: Parameter `*p`
  2199. }
  2200. 
  2201. const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
        ^
  2202.                                       const uint8_t *end,
  2203.                                       uint32_t * restrict state)

libavcodec/utils.c:2213:9: Binary operation: ([1099511627520, +oo] + *buf):unsigned32 by call to `avpriv_find_start_code` 
  2211.     for (i = 0; i < 3; i++) {
  2212.         uint32_t tmp = *state << 8;
  2213.         *state = tmp + *(p++);
                ^
  2214.         if (tmp == 0x100 || p == end)
  2215.             return p;

const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
                                      const uint8_t *end,
                                      uint32_t * restrict state)
{
    int i;
    assert(p <= end);
    if (p >= end)
        return end;
    for (i = 0; i < 3; i++) {
        uint32_t tmp = *state << 8;
        *state = tmp + *(p++);
        if (tmp == 0x100 || p == end)
            return p;
    }
    while (p < end) {
        if      (p[-1] > 1      ) p += 3;
        else if (p[-2]          ) p += 2;
        else if (p[-3]|(p[-1]-1)) p++;
        else {
            p++;
            break;
        }
    }
    p = FFMIN(p, end) - 4;
    *state = AV_RB32(p);
    return p + 4;
}
['static void mpegvideo_extract_headers(AVCodecParserContext *s,\n                                      AVCodecContext *avctx,\n                                      const uint8_t *buf, int buf_size)\n{\n    struct MpvParseContext *pc = s->priv_data;\n    const uint8_t *buf_end = buf + buf_size;\n    uint32_t start_code;\n    int frame_rate_index, ext_type, bytes_left;\n    int frame_rate_ext_n, frame_rate_ext_d;\n    int top_field_first, repeat_first_field, progressive_frame;\n    int horiz_size_ext, vert_size_ext, bit_rate_ext;\n    int did_set_size=0;\n    s->repeat_pict = 0;\n    while (buf < buf_end) {\n        start_code= -1;\n        buf= avpriv_find_start_code(buf, buf_end, &start_code);\n        bytes_left = buf_end - buf;\n        switch(start_code) {\n        case PICTURE_START_CODE:\n            if (bytes_left >= 2) {\n                s->pict_type = (buf[1] >> 3) & 7;\n            }\n            break;\n        case SEQ_START_CODE:\n            if (bytes_left >= 7) {\n                pc->width  = (buf[0] << 4) | (buf[1] >> 4);\n                pc->height = ((buf[1] & 0x0f) << 8) | buf[2];\n                if(!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height){\n                    avcodec_set_dimensions(avctx, pc->width, pc->height);\n                    did_set_size=1;\n                }\n                frame_rate_index = buf[3] & 0xf;\n                pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num;\n                pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den;\n                avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;\n                avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;\n            }\n            break;\n        case EXT_START_CODE:\n            if (bytes_left >= 1) {\n                ext_type = (buf[0] >> 4);\n                switch(ext_type) {\n                case 0x1:\n                    if (bytes_left >= 6) {\n                        horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);\n                        vert_size_ext = (buf[2] >> 5) & 3;\n                        bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);\n                        frame_rate_ext_n = (buf[5] >> 5) & 3;\n                        frame_rate_ext_d = (buf[5] & 0x1f);\n                        pc->progressive_sequence = buf[1] & (1 << 3);\n                        avctx->has_b_frames= !(buf[5] >> 7);\n                        pc->width  |=(horiz_size_ext << 12);\n                        pc->height |=( vert_size_ext << 12);\n                        avctx->bit_rate += (bit_rate_ext << 18) * 400;\n                        if(did_set_size)\n                            avcodec_set_dimensions(avctx, pc->width, pc->height);\n                        avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2;\n                        avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1);\n                        avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;\n                    }\n                    break;\n                case 0x8:\n                    if (bytes_left >= 5) {\n                        top_field_first = buf[3] & (1 << 7);\n                        repeat_first_field = buf[3] & (1 << 1);\n                        progressive_frame = buf[4] & (1 << 7);\n                        s->repeat_pict = 1;\n                        if (repeat_first_field) {\n                            if (pc->progressive_sequence) {\n                                if (top_field_first)\n                                    s->repeat_pict = 5;\n                                else\n                                    s->repeat_pict = 3;\n                            } else if (progressive_frame) {\n                                s->repeat_pict = 2;\n                            }\n                        }\n                    }\n                    break;\n                }\n            }\n            break;\n        case -1:\n            goto the_end;\n        default:\n            if (start_code >= SLICE_MIN_START_CODE &&\n                start_code <= SLICE_MAX_START_CODE)\n                goto the_end;\n            break;\n        }\n    }\n the_end: ;\n}', 'const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,\n                                      const uint8_t *end,\n                                      uint32_t * restrict state)\n{\n    int i;\n    assert(p <= end);\n    if (p >= end)\n        return end;\n    for (i = 0; i < 3; i++) {\n        uint32_t tmp = *state << 8;\n        *state = tmp + *(p++);\n        if (tmp == 0x100 || p == end)\n            return p;\n    }\n    while (p < end) {\n        if      (p[-1] > 1      ) p += 3;\n        else if (p[-2]          ) p += 2;\n        else if (p[-3]|(p[-1]-1)) p++;\n        else {\n            p++;\n            break;\n        }\n    }\n    p = FFMIN(p, end) - 4;\n    *state = AV_RB32(p);\n    return p + 4;\n}']