libavcodec/loco.c:145: error: Integer Overflow L2
  ([0, +oo] - [0, 31]):unsigned32 by call to `loco_get_rice`.

libavcodec/loco.c:135:5: Call
133.     int i, j;
134. 
135.     bitstream_init8(&rc.bc, buf, buf_size);
         ^
136.     rc.save  = 0;
137.     rc.run   = 0;

libavcodec/bitstream.h:104:1: Parameter `bc->bits_left`
  102. 
  103. /* Initialize BitstreamContext with buffer size in bytes instead of bits. */
  104. static inline int bitstream_init8(BitstreamContext *bc, const uint8_t *buffer,
       ^
  105.                                   unsigned byte_size)
  106. {

libavcodec/loco.c:145:15: Call
143. 
144.     /* restore top left pixel */
145.     val     = loco_get_rice(&rc);
                   ^
146.     data[0] = 128 + val;
147.     /* restore top line */

libavcodec/loco.c:83:1: Parameter `r->bc.bits_left`
  81. }
  82. 
  83. static inline int loco_get_rice(RICEContext *r)
      ^
  84. {
  85.     int v;

libavcodec/loco.c:91:9: Call
  89.         return 0;
  90.     }
  91.     v = get_ur_golomb_jpegls(&r->bc, loco_get_rice_param(r), INT_MAX, 0);
              ^
  92.     loco_update_rice_param(r, (v + 1) >> 1);
  93.     if (!v) {

libavcodec/golomb.h:275:1: Parameter `k`
    273.  * read unsigned golomb rice code (jpegls).
    274.  */
    275. static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,
         ^
    276.                                        int esc_len)
    277. {

libavcodec/golomb.h:288:9: Call
    286.         buf >>= log - k;
    287.         buf  += (30 - log) << k;
    288.         bitstream_skip(bc, 32 + k - log);
                 ^
    289. 
    290.         return buf;

libavcodec/bitstream.h:241:1: Parameter `n`
      239. 
      240. /* Skip n bits in the buffer. */
      241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
           ^
      242. {
      243.     if (n <= bc->bits_left)

libavcodec/bitstream.h:244:9: Call
      242. {
      243.     if (n <= bc->bits_left)
      244.         skip_remaining(bc, n);
                   ^
      245.     else {
      246.         n -= bc->bits_left;

libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
        228. }
        229. 
        230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
             ^
        231. {
        232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `n`
        228. }
        229. 
        230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
             ^
        231. {
        232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - [0, 31]):unsigned32 by call to `loco_get_rice` 
        235.     bc->bits <<= n;
        236. #endif
        237.     bc->bits_left -= n;
                 ^
        238. }
        239. 

static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    bc->bits >>= n;
#else
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
}
['static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int height,\n                             int stride, const uint8_t *buf, int buf_size, int step)\n{\n    RICEContext rc;\n    int val;\n    int i, j;\n    bitstream_init8(&rc.bc, buf, buf_size);\n    rc.save  = 0;\n    rc.run   = 0;\n    rc.run2  = 0;\n    rc.lossy = l->lossy;\n    rc.sum   = 8;\n    rc.count = 1;\n    val     = loco_get_rice(&rc);\n    data[0] = 128 + val;\n    for (i = 1; i < width; i++) {\n        val = loco_get_rice(&rc);\n        data[i * step] = data[i * step - step] + val;\n    }\n    data += stride;\n    for (j = 1; j < height; j++) {\n        val = loco_get_rice(&rc);\n        data[0] = data[-stride] + val;\n        for (i = 1; i < width; i++) {\n            val = loco_get_rice(&rc);\n            data[i * step] = loco_predict(&data[i * step], stride, step) + val;\n        }\n        data += stride;\n    }\n    return (bitstream_tell(&rc.bc) + 7) >> 3;\n}', 'static inline int bitstream_init8(BitstreamContext *bc, const uint8_t *buffer,\n                                  unsigned byte_size)\n{\n    if (byte_size > INT_MAX / 8)\n        return AVERROR_INVALIDDATA;\n    return bitstream_init(bc, buffer, byte_size * 8);\n}', 'static inline int loco_get_rice(RICEContext *r)\n{\n    int v;\n    if (r->run > 0) {\n        r->run--;\n        loco_update_rice_param(r, 0);\n        return 0;\n    }\n    v = get_ur_golomb_jpegls(&r->bc, loco_get_rice_param(r), INT_MAX, 0);\n    loco_update_rice_param(r, (v + 1) >> 1);\n    if (!v) {\n        if (r->save >= 0) {\n            r->run = get_ur_golomb_jpegls(&r->bc, 2, INT_MAX, 0);\n            if (r->run > 1)\n                r->save += r->run + 1;\n            else\n                r->save -= 3;\n        } else\n            r->run2++;\n    } else {\n        v = ((v >> 1) + r->lossy) ^ -(v & 1);\n        if (r->run2 > 0) {\n            if (r->run2 > 2)\n                r->save += r->run2;\n            else\n                r->save -= 3;\n            r->run2 = 0;\n        }\n    }\n    return v;\n}', 'static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,\n                                       int esc_len)\n{\n    unsigned int buf;\n    int log;\n    buf = bitstream_peek(bc, 32);\n    log = av_log2(buf);\n    if (log - k >= 1 && 32 - log < limit) {\n        buf >>= log - k;\n        buf  += (30 - log) << k;\n        bitstream_skip(bc, 32 + k - log);\n        return buf;\n    } else {\n        int i;\n        for (i = 0; i < limit && bitstream_peek(bc, 1) == 0 && bitstream_bits_left(bc) > 0; i++)\n            bitstream_skip(bc, 1);\n        bitstream_skip(bc, 1);\n        if (i < limit - 1) {\n            if (k) {\n                buf = bitstream_read(bc, k);\n            } else {\n                buf = 0;\n            }\n            return buf + (i << k);\n        } else if (i == limit - 1) {\n            buf = bitstream_read(bc, esc_len);\n            return buf + 1;\n        } else\n            return -1;\n    }\n}', 'static inline void bitstream_skip(BitstreamContext *bc, unsigned n)\n{\n    if (n <= bc->bits_left)\n        skip_remaining(bc, n);\n    else {\n        n -= bc->bits_left;\n        skip_remaining(bc, bc->bits_left);\n        if (n >= 64) {\n            unsigned skip = n / 8;\n            n -= skip * 8;\n            bc->ptr += skip;\n        }\n        refill_64(bc);\n        if (n)\n            skip_remaining(bc, n);\n    }\n}', 'static inline void skip_remaining(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    bc->bits >>= n;\n#else\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n}']