libavformat/mpegts.c:760: error: Integer Overflow L2
  (32 - [0, 64]):unsigned32 by call to `bitstream_read`.

libavformat/mpegts.c:745:5: Call
743.     int dts_flag = -1, cts_flag = -1;
744.     int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
745.     bitstream_init(&bc, buf, buf_size * 8);
         ^
746. 
747.     if (sl->use_au_start)

libavcodec/bitstream.h:85:9: Assignment
  83.         bc->buffer    =
  84.         bc->ptr       = NULL;
  85.         bc->bits_left = 0;
              ^
  86.         return AVERROR_INVALIDDATA;
  87.     }

libavformat/mpegts.c:760:24: Call
758.         padding_flag = bitstream_read_bit(&bc);
759.     if (padding_flag)
760.         padding_bits = bitstream_read(&bc, 3);
                            ^
761. 
762.     if (!idle_flag && (!padding_flag || padding_bits != 0)) {

libavcodec/bitstream.h:183:1: Parameter `n`
  181. 
  182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
  183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
       ^
  184. {
  185.     if (!n)

libavcodec/bitstream.h:189:9: Call
  187. 
  188.     if (n > bc->bits_left) {
  189.         refill_32(bc);
               ^
  190.         if (bc->bits_left < 32)
  191.             bc->bits_left = n;

libavcodec/bitstream.h:60:1: <RHS trace>
58. }
59. 
60. static inline void refill_32(BitstreamContext *bc)
    ^
61. {
62.     if (bc->ptr >= bc->buffer_end)

libavcodec/bitstream.h:60:1: Parameter `bc->bits_left`
    58. }
    59. 
    60. static inline void refill_32(BitstreamContext *bc)
        ^
    61. {
    62.     if (bc->ptr >= bc->buffer_end)

libavcodec/bitstream.h:68:5: Binary operation: (32 - [0, 64]):unsigned32 by call to `bitstream_read` 
    66.     bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
    67. #else
    68.     bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
            ^
    69. #endif
    70.     bc->ptr       += 4;

static inline void refill_32(BitstreamContext *bc)
{
    if (bc->ptr >= bc->buffer_end)
        return;
#ifdef BITSTREAM_READER_LE
    bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
#else
    bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
#endif
    bc->ptr       += 4;
    bc->bits_left += 32;
}
['static int read_sl_header(PESContext *pes, SLConfigDescr *sl,\n                          const uint8_t *buf, int buf_size)\n{\n    BitstreamContext bc;\n    int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;\n    int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;\n    int dts_flag = -1, cts_flag = -1;\n    int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;\n    bitstream_init(&bc, buf, buf_size * 8);\n    if (sl->use_au_start)\n        au_start_flag = bitstream_read_bit(&bc);\n    if (sl->use_au_end)\n        au_end_flag = bitstream_read_bit(&bc);\n    if (!sl->use_au_start && !sl->use_au_end)\n        au_start_flag = au_end_flag = 1;\n    if (sl->ocr_len > 0)\n        ocr_flag = bitstream_read_bit(&bc);\n    if (sl->use_idle)\n        idle_flag = bitstream_read_bit(&bc);\n    if (sl->use_padding)\n        padding_flag = bitstream_read_bit(&bc);\n    if (padding_flag)\n        padding_bits = bitstream_read(&bc, 3);\n    if (!idle_flag && (!padding_flag || padding_bits != 0)) {\n        if (sl->packet_seq_num_len)\n            bitstream_skip(&bc, sl->packet_seq_num_len);\n        if (sl->degr_prior_len)\n            if (bitstream_read_bit(&bc))\n                bitstream_skip(&bc, sl->degr_prior_len);\n        if (ocr_flag)\n            bitstream_skip(&bc, sl->ocr_len);\n        if (au_start_flag) {\n            if (sl->use_rand_acc_pt)\n                bitstream_read_bit(&bc);\n            if (sl->au_seq_num_len > 0)\n                bitstream_skip(&bc, sl->au_seq_num_len);\n            if (sl->use_timestamps) {\n                dts_flag = bitstream_read_bit(&bc);\n                cts_flag = bitstream_read_bit(&bc);\n            }\n        }\n        if (sl->inst_bitrate_len)\n            inst_bitrate_flag = bitstream_read_bit(&bc);\n        if (dts_flag == 1)\n            dts = bitstream_read_63(&bc, sl->timestamp_len);\n        if (cts_flag == 1)\n            cts = bitstream_read_63(&bc, sl->timestamp_len);\n        if (sl->au_len > 0)\n            bitstream_skip(&bc, sl->au_len);\n        if (inst_bitrate_flag)\n            bitstream_skip(&bc, sl->inst_bitrate_len);\n    }\n    if (dts != AV_NOPTS_VALUE)\n        pes->dts = dts;\n    if (cts != AV_NOPTS_VALUE)\n        pes->pts = cts;\n    if (sl->timestamp_len && sl->timestamp_res)\n        avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);\n    return (bitstream_tell(&bc) + 7) >> 3;\n}', 'static inline int bitstream_init(BitstreamContext *bc, const uint8_t *buffer,\n                                 unsigned bit_size)\n{\n    unsigned buffer_size;\n    if (bit_size > INT_MAX - 7 || !buffer) {\n        buffer        =\n        bc->buffer    =\n        bc->ptr       = NULL;\n        bc->bits_left = 0;\n        return AVERROR_INVALIDDATA;\n    }\n    buffer_size = (bit_size + 7) >> 3;\n    bc->buffer       = buffer;\n    bc->buffer_end   = buffer + buffer_size;\n    bc->ptr          = bc->buffer;\n    bc->size_in_bits = bit_size;\n    bc->bits_left    = 0;\n    bc->bits         = 0;\n    refill_64(bc);\n    return 0;\n}', 'static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)\n{\n    if (!n)\n        return 0;\n    if (n > bc->bits_left) {\n        refill_32(bc);\n        if (bc->bits_left < 32)\n            bc->bits_left = n;\n    }\n    return get_val(bc, n);\n}', 'static inline void refill_32(BitstreamContext *bc)\n{\n    if (bc->ptr >= bc->buffer_end)\n        return;\n#ifdef BITSTREAM_READER_LE\n    bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;\n#else\n    bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);\n#endif\n    bc->ptr       += 4;\n    bc->bits_left += 32;\n}']