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

libavcodec/mimic.c:304:48: Call
302.                         ctx->idsp.idct_put(dst, stride, ctx->dct_block);
303.                     } else {
304.                         unsigned int backref = bitstream_read(&ctx->bc, 4);
                                                    ^
305.                         int index            = (ctx->cur_index + backref) & 15;
306.                         uint8_t *p           = ctx->frames[index].f->data[0];

libavcodec/bitstream.h:183:1: Parameter `n`
  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/bitstream.h:194:12: Call
  192.     }
  193. 
  194.     return get_val(bc, n);
                  ^
  195. }
  196. 

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: ([1, +oo] - 4):unsigned32 by call to `bitstream_read` 
    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 decode(MimicContext *ctx, int quality, int num_coeffs,\n                  int is_iframe)\n{\n    int ret, y, x, plane, cur_row = 0;\n    for (plane = 0; plane < 3; plane++) {\n        const int is_chroma = !!plane;\n        const int qscale    = av_clip(10000 - quality, is_chroma ? 1000 : 2000,\n                                      10000) << 2;\n        const int stride    = ctx->frames[ctx->cur_index ].f->linesize[plane];\n        const uint8_t *src  = ctx->frames[ctx->prev_index].f->data[plane];\n        uint8_t       *dst  = ctx->frames[ctx->cur_index ].f->data[plane];\n        for (y = 0; y < ctx->num_vblocks[plane]; y++) {\n            for (x = 0; x < ctx->num_hblocks[plane]; x++) {\n                if (is_iframe || bitstream_read_bit(&ctx->bc) == is_chroma) {\n                    if (is_chroma || is_iframe || !bitstream_read_bit(&ctx->bc)) {\n                        if ((ret = vlc_decode_block(ctx, num_coeffs,\n                                                    qscale)) < 0) {\n                            av_log(ctx->avctx, AV_LOG_ERROR, "Error decoding "\n                                   "block.\\n");\n                            return ret;\n                        }\n                        ctx->idsp.idct_put(dst, stride, ctx->dct_block);\n                    } else {\n                        unsigned int backref = bitstream_read(&ctx->bc, 4);\n                        int index            = (ctx->cur_index + backref) & 15;\n                        uint8_t *p           = ctx->frames[index].f->data[0];\n                        if (index != ctx->cur_index && p) {\n                            ff_thread_await_progress(&ctx->frames[index],\n                                                     cur_row, 0);\n                            p += src -\n                                 ctx->frames[ctx->prev_index].f->data[plane];\n                            ctx->hdsp.put_pixels_tab[1][0](dst, p, stride, 8);\n                        } else {\n                            av_log(ctx->avctx, AV_LOG_ERROR,\n                                     "No such backreference! Buggy sample.\\n");\n                        }\n                    }\n                } else {\n                    ff_thread_await_progress(&ctx->frames[ctx->prev_index],\n                                             cur_row, 0);\n                    ctx->hdsp.put_pixels_tab[1][0](dst, src, stride, 8);\n                }\n                src += 8;\n                dst += 8;\n            }\n            src += (stride - ctx->num_hblocks[plane]) << 3;\n            dst += (stride - ctx->num_hblocks[plane]) << 3;\n            ff_thread_report_progress(&ctx->frames[ctx->cur_index],\n                                      cur_row++, 0);\n        }\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}']