libavcodec/bink.c:619: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`.

libavcodec/bink.c:616:17: Call
614.     coef_list[list_end] = 3;  mode_list[list_end++] = 3;
615. 
616.     for (bits = bitstream_read(bc, 4) - 1; bits >= 0; bits--) {
                     ^
617.         list_pos = list_start;
618.         while (list_pos < list_end) {

libavcodec/bitstream.h:183:1: Parameter `bc->bits_left`
  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/bink.c:619:66: Call
617.         list_pos = list_start;
618.         while (list_pos < list_end) {
619.             if (!(mode_list[list_pos] | coef_list[list_pos]) || !bitstream_read_bit(bc)) {
                                                                      ^
620.                 list_pos++;
621.                 continue;

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

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

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

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

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

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

libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 
    137.     bc->bits <<= n;
    138. #endif
    139.     bc->bits_left -= n;
             ^
    140. 
    141.     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 read_dct_coeffs(BitstreamContext *bc, int32_t block[64],\n                           const uint8_t *scan,\n                           const int32_t quant_matrices[16][64], int q)\n{\n    int coef_list[128];\n    int mode_list[128];\n    int i, t, bits, ccoef, mode;\n    int list_start = 64, list_end = 64, list_pos;\n    int coef_count = 0;\n    int coef_idx[64];\n    int quant_idx;\n    const int32_t *quant;\n    coef_list[list_end] = 4;  mode_list[list_end++] = 0;\n    coef_list[list_end] = 24; mode_list[list_end++] = 0;\n    coef_list[list_end] = 44; mode_list[list_end++] = 0;\n    coef_list[list_end] = 1;  mode_list[list_end++] = 3;\n    coef_list[list_end] = 2;  mode_list[list_end++] = 3;\n    coef_list[list_end] = 3;  mode_list[list_end++] = 3;\n    for (bits = bitstream_read(bc, 4) - 1; bits >= 0; bits--) {\n        list_pos = list_start;\n        while (list_pos < list_end) {\n            if (!(mode_list[list_pos] | coef_list[list_pos]) || !bitstream_read_bit(bc)) {\n                list_pos++;\n                continue;\n            }\n            ccoef = coef_list[list_pos];\n            mode  = mode_list[list_pos];\n            switch (mode) {\n            case 0:\n                coef_list[list_pos] = ccoef + 4;\n                mode_list[list_pos] = 1;\n            case 2:\n                if (mode == 2) {\n                    coef_list[list_pos]   = 0;\n                    mode_list[list_pos++] = 0;\n                }\n                for (i = 0; i < 4; i++, ccoef++) {\n                    if (bitstream_read_bit(bc)) {\n                        coef_list[--list_start] = ccoef;\n                        mode_list[  list_start] = 3;\n                    } else {\n                        if (!bits) {\n                            t = 1 - (bitstream_read_bit(bc) << 1);\n                        } else {\n                            t = bitstream_read(bc, bits) | 1 << bits;\n                            t = bitstream_apply_sign(bc, t);\n                        }\n                        block[scan[ccoef]] = t;\n                        coef_idx[coef_count++] = ccoef;\n                    }\n                }\n                break;\n            case 1:\n                mode_list[list_pos] = 2;\n                for (i = 0; i < 3; i++) {\n                    ccoef += 4;\n                    coef_list[list_end]   = ccoef;\n                    mode_list[list_end++] = 2;\n                }\n                break;\n            case 3:\n                if (!bits) {\n                    t = 1 - (bitstream_read_bit(bc) << 1);\n                } else {\n                    t = bitstream_read(bc, bits) | 1 << bits;\n                    t = bitstream_apply_sign(bc, t);\n                }\n                block[scan[ccoef]] = t;\n                coef_idx[coef_count++] = ccoef;\n                coef_list[list_pos]   = 0;\n                mode_list[list_pos++] = 0;\n                break;\n            }\n        }\n    }\n    if (q == -1) {\n        quant_idx = bitstream_read(bc, 4);\n    } else {\n        quant_idx = q;\n    }\n    if (quant_idx >= 16)\n        return AVERROR_INVALIDDATA;\n    quant = quant_matrices[quant_idx];\n    block[0] = (block[0] * quant[0]) >> 11;\n    for (i = 0; i < coef_count; i++) {\n        int idx = coef_idx[i];\n        block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11;\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 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}']