libavcodec/cbs_h2645.c:102: error: Integer Overflow L2
  ([0, max(64, `bc->bits_left`)] - 1):unsigned32 by call to `bitstream_read_bit`.

libavcodec/cbs_h2645.c:84:1: Parameter `bc->bits_left`
82. }
83. 
84. static int cbs_read_se_golomb(CodedBitstreamContext *ctx, BitstreamContext *bc,
    ^
85.                               const char *name, int32_t *write_to,
86.                               int32_t range_min, int32_t range_max)

libavcodec/cbs_h2645.c:102:13: Call
100.             return AVERROR_INVALIDDATA;
101.         }
102.         k = bitstream_read_bit(bc);
                 ^
103.         bits[i] = k ? '1' : '0';
104.         if (k)

libavcodec/bitstream.h:144:1: Parameter `bc->bits_left`
  142. 
  143. /* Return one bit from the buffer. */
  144. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
       ^
  145. {
  146.     if (!bc->bits_left)

libavcodec/bitstream.h:149:12: Call
  147.         refill_64(bc);
  148. 
  149.     return get_val(bc, 1);
                  ^
  150. }
  151. 

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: ([0, max(64, bc->bits_left)] - 1):unsigned32 by call to `bitstream_read_bit` 
    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_read_se_golomb(CodedBitstreamContext *ctx, BitstreamContext *bc,\n                              const char *name, int32_t *write_to,\n                              int32_t range_min, int32_t range_max)\n{\n    int32_t value;\n    int position, i, j;\n    unsigned int k;\n    uint32_t v;\n    char bits[65];\n    position = bitstream_tell(bc);\n    for (i = 0; i < 32; i++) {\n        if (bitstream_bits_left(bc) < i + 1) {\n            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "\n                   "%s: bitstream ended.\\n", name);\n            return AVERROR_INVALIDDATA;\n        }\n        k = bitstream_read_bit(bc);\n        bits[i] = k ? \'1\' : \'0\';\n        if (k)\n            break;\n    }\n    if (i >= 32) {\n        av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "\n               "%s: more than 31 zeroes.\\n", name);\n        return AVERROR_INVALIDDATA;\n    }\n    v = 1;\n    for (j = 0; j < i; j++) {\n        k = bitstream_read_bit(bc);\n        bits[i + j + 1] = k ? \'1\' : \'0\';\n        v = v << 1 | k;\n    }\n    bits[i + j + 1] = 0;\n    if (v & 1)\n        value = -(int32_t)(v / 2);\n    else\n        value = v / 2;\n    if (ctx->trace_enable)\n        ff_cbs_trace_syntax_element(ctx, position, name, bits, value);\n    if (value < range_min || value > range_max) {\n        av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "\n               "%"PRId32", but must be in [%"PRId32",%"PRId32"].\\n",\n               name, value, range_min, range_max);\n        return AVERROR_INVALIDDATA;\n    }\n    *write_to = value;\n    return 0;\n}', 'static inline unsigned bitstream_read_bit(BitstreamContext *bc)\n{\n    if (!bc->bits_left)\n        refill_64(bc);\n    return get_val(bc, 1);\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}']