libavcodec/mpeg12.c:1883: error: Integer Overflow L1
  ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `avpriv_mpv_find_start_code`.

libavcodec/mpeg12.c:1882:9: Assignment
1880.             return 0;
1881. 
1882.         start_code = -1;
              ^
1883.         buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);
1884.         mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;

libavcodec/mpeg12.c:1883:15: Call
1881. 
1882.         start_code = -1;
1883.         buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);
                    ^
1884.         mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
1885.         if (s->picture_structure == PICT_BOTTOM_FIELD)

libavcodec/mpegvideo.c:177:1: <LHS trace>
175. }
176. 
177. const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
     ^
178.                                           const uint8_t *end,
179.                                           uint32_t * restrict state)

libavcodec/mpegvideo.c:177:1: Parameter `*state`
  175. }
  176. 
  177. const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
       ^
  178.                                           const uint8_t *end,
  179.                                           uint32_t * restrict state)

libavcodec/mpegvideo.c:188:9: Assignment
  186. 
  187.     for (i = 0; i < 3; i++) {
  188.         uint32_t tmp = *state << 8;
               ^
  189.         *state = tmp + *(p++);
  190.         if (tmp == 0x100 || p == end)

libavcodec/mpegvideo.c:177:1: <RHS trace>
175. }
176. 
177. const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
     ^
178.                                           const uint8_t *end,
179.                                           uint32_t * restrict state)

libavcodec/mpegvideo.c:177:1: Parameter `*p`
  175. }
  176. 
  177. const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
       ^
  178.                                           const uint8_t *end,
  179.                                           uint32_t * restrict state)

libavcodec/mpegvideo.c:189:9: Binary operation: ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `avpriv_mpv_find_start_code` 
  187.     for (i = 0; i < 3; i++) {
  188.         uint32_t tmp = *state << 8;
  189.         *state = tmp + *(p++);
               ^
  190.         if (tmp == 0x100 || p == end)
  191.             return p;

const uint8_t *avpriv_mpv_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 int slice_decode_thread(AVCodecContext *c, void *arg)\n{\n    MpegEncContext *s   = *(void**)arg;\n    const uint8_t *buf  = s->gb.buffer;\n    int mb_y            = s->start_mb_y;\n    const int field_pic = s->picture_structure != PICT_FRAME;\n    s->er.error_count = (3 * (s->end_mb_y - s->start_mb_y) * s->mb_width) >> field_pic;\n    for (;;) {\n        uint32_t start_code;\n        int ret;\n        ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf);\n        emms_c();\n        av_dlog(c, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\\n",\n                ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,\n                s->start_mb_y, s->end_mb_y, s->er.error_count);\n        if (ret < 0) {\n            if (c->err_recognition & AV_EF_EXPLODE)\n                return ret;\n            if (s->resync_mb_x >= 0 && s->resync_mb_y >= 0)\n                ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_AC_ERROR | ER_DC_ERROR | ER_MV_ERROR);\n        } else {\n            ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_END | ER_DC_END | ER_MV_END);\n        }\n        if (s->mb_y == s->end_mb_y)\n            return 0;\n        start_code = -1;\n        buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);\n        mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;\n        if (s->picture_structure == PICT_BOTTOM_FIELD)\n            mb_y++;\n        if (mb_y < 0 || mb_y >= s->end_mb_y)\n            return -1;\n    }\n}', 'const uint8_t *avpriv_mpv_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}']