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

libavcodec/indeo4.c:161:69: Call
159.     ctx->uses_tiling = bitstream_read_bit(&ctx->bc);
160.     if (ctx->uses_tiling) {
161.         pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, bitstream_read(&ctx->bc, 4));
                                                                         ^
162.         pic_conf.tile_width  = scale_tile_size(pic_conf.pic_width,  bitstream_read(&ctx->bc, 4));
163.     } else {

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_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)\n{\n    int             pic_size_indx, i, p;\n    IVIPicConfig    pic_conf;\n    if (bitstream_read(&ctx->bc, 18) != 0x3FFF8) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid picture start code!\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    ctx->prev_frame_type = ctx->frame_type;\n    ctx->frame_type      = bitstream_read(&ctx->bc, 3);\n    if (ctx->frame_type == 7) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d\\n", ctx->frame_type);\n        return AVERROR_INVALIDDATA;\n    }\n    if (ctx->frame_type == IVI4_FRAMETYPE_BIDIR)\n        ctx->has_b_frames = 1;\n    ctx->has_transp = bitstream_read_bit(&ctx->bc);\n    if (bitstream_read_bit(&ctx->bc)) {\n        av_log(avctx, AV_LOG_ERROR, "Sync bit is set!\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    ctx->data_size = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 24) : 0;\n    if (ctx->frame_type >= IVI4_FRAMETYPE_NULL_FIRST) {\n        ff_dlog(avctx, "Null frame encountered!\\n");\n        return 0;\n    }\n    if (bitstream_read_bit(&ctx->bc)) {\n        bitstream_skip(&ctx->bc, 32);\n        ff_dlog(avctx, "Password-protected clip!\\n");\n    }\n    pic_size_indx = bitstream_read(&ctx->bc, 3);\n    if (pic_size_indx == IVI4_PIC_SIZE_ESC) {\n        pic_conf.pic_height = bitstream_read(&ctx->bc, 16);\n        pic_conf.pic_width  = bitstream_read(&ctx->bc, 16);\n    } else {\n        pic_conf.pic_height = ivi4_common_pic_sizes[pic_size_indx * 2 + 1];\n        pic_conf.pic_width  = ivi4_common_pic_sizes[pic_size_indx * 2    ];\n    }\n    ctx->uses_tiling = bitstream_read_bit(&ctx->bc);\n    if (ctx->uses_tiling) {\n        pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, bitstream_read(&ctx->bc, 4));\n        pic_conf.tile_width  = scale_tile_size(pic_conf.pic_width,  bitstream_read(&ctx->bc, 4));\n    } else {\n        pic_conf.tile_height = pic_conf.pic_height;\n        pic_conf.tile_width  = pic_conf.pic_width;\n    }\n    if (bitstream_read(&ctx->bc, 2)) {\n        av_log(avctx, AV_LOG_ERROR, "Only YVU9 picture format is supported!\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;\n    pic_conf.chroma_width  = (pic_conf.pic_width  + 3) >> 2;\n    pic_conf.luma_bands = decode_plane_subdivision(&ctx->bc);\n    if (pic_conf.luma_bands)\n        pic_conf.chroma_bands = decode_plane_subdivision(&ctx->bc);\n    ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;\n    if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {\n        av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\\n",\n               pic_conf.luma_bands, pic_conf.chroma_bands);\n        return AVERROR_INVALIDDATA;\n    }\n    if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {\n        if (ff_ivi_init_planes(ctx->planes, &pic_conf, 1)) {\n            av_log(avctx, AV_LOG_ERROR, "Couldn\'t reallocate color planes!\\n");\n            ctx->pic_conf.luma_bands = 0;\n            return AVERROR(ENOMEM);\n        }\n        ctx->pic_conf = pic_conf;\n        for (p = 0; p <= 2; p++) {\n            for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {\n                ctx->planes[p].bands[i].mb_size  = !p ? (!ctx->is_scalable ? 16 : 8) : 4;\n                ctx->planes[p].bands[i].blk_size = !p ? 8 : 4;\n            }\n        }\n        if (ff_ivi_init_tiles(ctx->planes, ctx->pic_conf.tile_width,\n                              ctx->pic_conf.tile_height)) {\n            av_log(avctx, AV_LOG_ERROR,\n                   "Couldn\'t reallocate internal structures!\\n");\n            return AVERROR(ENOMEM);\n        }\n    }\n    ctx->frame_num = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 20) : 0;\n    if (bitstream_read_bit(&ctx->bc))\n        bitstream_skip(&ctx->bc, 8);\n    if (ff_ivi_dec_huff_desc(&ctx->bc, bitstream_read_bit(&ctx->bc), IVI_MB_HUFF,  &ctx->mb_vlc,  avctx) ||\n        ff_ivi_dec_huff_desc(&ctx->bc, bitstream_read_bit(&ctx->bc), IVI_BLK_HUFF, &ctx->blk_vlc, avctx))\n        return AVERROR_INVALIDDATA;\n    ctx->rvmap_sel = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 3) : 8;\n    ctx->in_imf = bitstream_read_bit(&ctx->bc);\n    ctx->in_q   = bitstream_read_bit(&ctx->bc);\n    ctx->pic_glob_quant = bitstream_read(&ctx->bc, 5);\n    ctx->unknown1 = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 3) : 0;\n    ctx->checksum = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 16) : 0;\n    while (bitstream_read_bit(&ctx->bc)) {\n        ff_dlog(avctx, "Pic hdr extension encountered!\\n");\n        bitstream_skip(&ctx->bc, 8);\n    }\n    if (bitstream_read_bit(&ctx->bc)) {\n        av_log(avctx, AV_LOG_ERROR, "Bad blocks bits encountered!\\n");\n    }\n    bitstream_align(&ctx->bc);\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}']