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

libavcodec/pixlet.c:210:9: Assignment
208.             return AVERROR_INVALIDDATA;
209.     } else {
210.         nbits = 1;
             ^
211.     }
212. 

libavcodec/pixlet.c:223:20: Call
221.         cnt1 = get_unary(bc, 0, length);
222.         if (cnt1 >= length) {
223.             cnt1 = bitstream_read(bc, nbits);
                        ^
224.         } else {
225.             pfx    = 14 + (((value - 14) >> 32) & (value - 14));

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/pixlet.c:262:18: Call
260.         pfx    = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
261.         escape = av_mod_uintp2(16383, pfx);
262.         cnt1   = get_unary(bc, 0, 8);
                      ^
263.         if (cnt1 < 8) {
264.             if (pfx < 1 || pfx > 25)

libavcodec/unary.h:33:1: Parameter `bc->bits_left`
  31.  * @return Unary length/index
  32.  */
  33. static inline int get_unary(BitstreamContext *bc, int stop, int len)
      ^
  34. {
  35.     int i;

libavcodec/pixlet.c:274:17: Call
272.             rlen = value + escape * cnt1 - 1;
273.         } else {
274.             if (bitstream_read_bit(bc))
                     ^
275.                 value = bitstream_read(bc, 16);
276.             else

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_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,\n                            int size, int64_t c, int a, int64_t d,\n                            int width, ptrdiff_t stride)\n{\n    PixletContext *ctx = avctx->priv_data;\n    BitstreamContext *bc = &ctx->bc;\n    unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k;\n    int ret, escape, pfx, cthulu, yflag, xflag, flag = 0;\n    int64_t state = 3, value, tmp;\n    ret = bitstream_init8(bc, src, bytestream2_get_bytes_left(&ctx->gb));\n    if (ret < 0)\n        return ret;\n    cthulu = (a >= 0) + (a ^ (a >> 31)) - (a >> 31);\n    if (cthulu != 1) {\n        nbits = 33 - ff_clz(cthulu - 1);\n        if (nbits > 16)\n            return AVERROR_INVALIDDATA;\n    } else {\n        nbits = 1;\n    }\n    length = 25 - nbits;\n    while (i < size) {\n        if (state >> 8 != -3)\n            value = ff_clz((state >> 8) + 3) ^ 0x1F;\n        else\n            value = -1;\n        cnt1 = get_unary(bc, 0, length);\n        if (cnt1 >= length) {\n            cnt1 = bitstream_read(bc, nbits);\n        } else {\n            pfx    = 14 + (((value - 14) >> 32) & (value - 14));\n            cnt1  *= (1 << pfx) - 1;\n            shbits = bitstream_read(bc, pfx);\n            if (shbits <= 1) {\n                bitstream_unget(bc, shbits & 1, 1);\n                shbits = 1;\n            }\n            cnt1 += shbits - 1;\n        }\n        xflag = flag + cnt1;\n        yflag = xflag;\n        if (flag + cnt1 == 0) {\n            value = 0;\n        } else {\n            xflag &= 1u;\n            tmp    = c * ((yflag + 1) >> 1) + (c >> 1);\n            value  = xflag + (tmp ^ -xflag);\n        }\n        i++;\n        dst[j++] = value;\n        if (j == width) {\n            j    = 0;\n            dst += stride;\n        }\n        state += d * yflag - (d * state >> 8);\n        flag = 0;\n        if (state * 4 > 0xFF || i >= size)\n            continue;\n        pfx    = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;\n        escape = av_mod_uintp2(16383, pfx);\n        cnt1   = get_unary(bc, 0, 8);\n        if (cnt1 < 8) {\n            if (pfx < 1 || pfx > 25)\n                return AVERROR_INVALIDDATA;\n            value = bitstream_read(bc, pfx);\n            if (value <= 1) {\n                bitstream_unget(bc, value & 1, 1);\n                value = 1;\n            }\n            rlen = value + escape * cnt1 - 1;\n        } else {\n            if (bitstream_read_bit(bc))\n                value = bitstream_read(bc, 16);\n            else\n                value = bitstream_read(bc, 8);\n            rlen = value + 8 * escape;\n        }\n        if (rlen > 0xFFFF || i + rlen > size)\n            return AVERROR_INVALIDDATA;\n        i += rlen;\n        for (k = 0; k < rlen; k++) {\n            dst[j++] = 0;\n            if (j == width) {\n                j    = 0;\n                dst += stride;\n            }\n        }\n        state = 0;\n        flag  = rlen < 0xFFFF ? 1 : 0;\n    }\n    bitstream_align(bc);\n    return bitstream_tell(bc) >> 3;\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 int get_unary(BitstreamContext *bc, int stop, int len)\n{\n    int i;\n    for (i = 0; i < len && bitstream_read_bit(bc) != stop; i++)\n        ;\n    return i;\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}']