libavcodec/cbs_mpeg2.c:274: error: Integer Overflow L2
  ([1, +oo] - 16):unsigned32 by call to `bitstream_read`.

libavcodec/cbs_mpeg2.c:274:31: Call
272. 
273.         while (bitstream_bits_left(&bc) > 15)
274.             put_bits(pbc, 16, bitstream_read(&bc, 16));
                                   ^
275. 
276.         bits_left = bitstream_bits_left(&bc);

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

libavcodec/bitstream.h:193:12: Call
  191.     }
  192. 
  193.     return get_val(bc, n);
                  ^
  194. }
  195. 

libavcodec/bitstream.h:129:1: <LHS trace>
127. }
128. 
129. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
     ^
130. {
131. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:129:1: Parameter `bc->bits_left`
    127. }
    128. 
    129. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
         ^
    130. {
    131. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:129:1: <RHS trace>
127. }
128. 
129. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
     ^
130. {
131. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:129:1: Parameter `n`
    127. }
    128. 
    129. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
         ^
    130. {
    131. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:138:5: Binary operation: ([1, +oo] - 16):unsigned32 by call to `bitstream_read` 
    136.     bc->bits <<= n;
    137. #endif
    138.     bc->bits_left -= n;
             ^
    139. 
    140.     return ret;

static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
    bc->bits >>= n;
#else
    uint64_t ret = bc->bits >> (64 - n);
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
    return ret;
}
['static int cbs_mpeg2_write_slice(CodedBitstreamContext *ctx,\n                                 CodedBitstreamUnit *unit,\n                                 PutBitContext *pbc)\n{\n    MPEG2RawSlice *slice = unit->content;\n    BitstreamContext bc;\n    size_t bits_left;\n    int err;\n    err = cbs_mpeg2_write_slice_header(ctx, pbc, &slice->header);\n    if (err < 0)\n        return err;\n    if (slice->data) {\n        if (slice->data_size * 8 + 8 > put_bits_left(pbc))\n            return AVERROR(ENOSPC);\n        bitstream_init(&bc, slice->data, slice->data_size * 8);\n        bitstream_skip(&bc, slice->data_bit_start);\n        while (bitstream_bits_left(&bc) > 15)\n            put_bits(pbc, 16, bitstream_read(&bc, 16));\n        bits_left = bitstream_bits_left(&bc);\n        put_bits(pbc, bits_left, bitstream_read(&bc, bits_left));\n        while (put_bits_count(pbc) % 8 != 0)\n            put_bits(pbc, 1, 0);\n    }\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 uint64_t get_val(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);\n    bc->bits >>= n;\n#else\n    uint64_t ret = bc->bits >> (64 - n);\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n    return ret;\n}']