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

libavcodec/indeo4.c:305:28: Call
303.         band->inherit_qdelta = bitstream_read_bit(&ctx->bc);
304. 
305.         band->glob_quant = bitstream_read(&ctx->bc, 5);
                                ^
306. 
307.         if (!bitstream_read_bit(&ctx->bc) || ctx->frame_type == IVI4_FRAMETYPE_INTRA) {

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] - 5):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_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,\n                           AVCodecContext *avctx)\n{\n    int plane, band_num, indx, transform_id, scan_indx;\n    int i;\n    plane    = bitstream_read(&ctx->bc, 2);\n    band_num = bitstream_read(&ctx->bc, 4);\n    if (band->plane != plane || band->band_num != band_num) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid band header sequence!\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    band->is_empty = bitstream_read_bit(&ctx->bc);\n    if (!band->is_empty) {\n        int old_blk_size = band->blk_size;\n        if (bitstream_read_bit(&ctx->bc))\n            bitstream_skip(&ctx->bc, 16);\n        band->is_halfpel = bitstream_read(&ctx->bc, 2);\n        if (band->is_halfpel >= 2) {\n            av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported mv resolution: %d!\\n",\n                   band->is_halfpel);\n            return AVERROR_INVALIDDATA;\n        }\n        if (!band->is_halfpel)\n            ctx->uses_fullpel = 1;\n        band->checksum_present = bitstream_read_bit(&ctx->bc);\n        if (band->checksum_present)\n            band->checksum = bitstream_read(&ctx->bc, 16);\n        indx = bitstream_read(&ctx->bc, 2);\n        if (indx == 3) {\n            av_log(avctx, AV_LOG_ERROR, "Invalid block size!\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        band->mb_size  = 16 >> indx;\n        band->blk_size = 8 >> (indx >> 1);\n        band->inherit_mv     = bitstream_read_bit(&ctx->bc);\n        band->inherit_qdelta = bitstream_read_bit(&ctx->bc);\n        band->glob_quant = bitstream_read(&ctx->bc, 5);\n        if (!bitstream_read_bit(&ctx->bc) || ctx->frame_type == IVI4_FRAMETYPE_INTRA) {\n            transform_id = bitstream_read(&ctx->bc, 5);\n            if (transform_id >= FF_ARRAY_ELEMS(transforms) ||\n                !transforms[transform_id].inv_trans) {\n                avpriv_request_sample(avctx, "Transform %d", transform_id);\n                return AVERROR_PATCHWELCOME;\n            }\n            if ((transform_id >= 7 && transform_id <= 9) ||\n                 transform_id == 17) {\n                avpriv_request_sample(avctx, "DCT transform");\n                return AVERROR_PATCHWELCOME;\n            }\n            if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)\n                ctx->uses_haar = 1;\n            band->inv_transform = transforms[transform_id].inv_trans;\n            band->dc_transform  = transforms[transform_id].dc_trans;\n            band->is_2d_trans   = transforms[transform_id].is_2d_trans;\n            if (transform_id < 10)\n                band->transform_size = 8;\n            else\n                band->transform_size = 4;\n            if (band->blk_size != band->transform_size)\n                return AVERROR_INVALIDDATA;\n            scan_indx = bitstream_read(&ctx->bc, 4);\n            if (scan_indx == 15) {\n                av_log(avctx, AV_LOG_ERROR, "Custom scan pattern encountered!\\n");\n                return AVERROR_INVALIDDATA;\n            }\n            if (scan_indx > 4 && scan_indx < 10) {\n                if (band->blk_size != 4)\n                    return AVERROR_INVALIDDATA;\n            } else if (band->blk_size != 8)\n                return AVERROR_INVALIDDATA;\n            band->scan = scan_index_to_tab[scan_indx];\n            band->quant_mat = bitstream_read(&ctx->bc, 5);\n            if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {\n                if (band->quant_mat == 31)\n                    av_log(avctx, AV_LOG_ERROR,\n                           "Custom quant matrix encountered!\\n");\n                else\n                    avpriv_request_sample(avctx, "Quantization matrix %d",\n                                          band->quant_mat);\n                band->quant_mat = -1;\n                return AVERROR_INVALIDDATA;\n            }\n        } else {\n            if (old_blk_size != band->blk_size) {\n                av_log(avctx, AV_LOG_ERROR,\n                       "The band block size does not match the configuration "\n                       "inherited\\n");\n                return AVERROR_INVALIDDATA;\n            }\n            if (band->quant_mat < 0) {\n                av_log(avctx, AV_LOG_ERROR, "Invalid quant_mat inherited\\n");\n                return AVERROR_INVALIDDATA;\n            }\n        }\n        if (!bitstream_read_bit(&ctx->bc))\n            band->blk_vlc.tab = ctx->blk_vlc.tab;\n        else\n            if (ff_ivi_dec_huff_desc(&ctx->bc, 1, IVI_BLK_HUFF,\n                                     &band->blk_vlc, avctx))\n                return AVERROR_INVALIDDATA;\n        band->rvmap_sel = bitstream_read_bit(&ctx->bc) ? bitstream_read(&ctx->bc, 3) : 8;\n        band->num_corr = 0;\n        if (bitstream_read_bit(&ctx->bc)) {\n            band->num_corr = bitstream_read(&ctx->bc, 8);\n            if (band->num_corr > 61) {\n                av_log(avctx, AV_LOG_ERROR, "Too many corrections: %d\\n",\n                       band->num_corr);\n                return AVERROR_INVALIDDATA;\n            }\n            for (i = 0; i < band->num_corr * 2; i++)\n                band->corr[i] = bitstream_read(&ctx->bc, 8);\n        }\n    }\n    if (band->blk_size == 8) {\n        band->intra_base = &ivi4_quant_8x8_intra[quant_index_to_tab[band->quant_mat]][0];\n        band->inter_base = &ivi4_quant_8x8_inter[quant_index_to_tab[band->quant_mat]][0];\n    } else {\n        band->intra_base = &ivi4_quant_4x4_intra[quant_index_to_tab[band->quant_mat]][0];\n        band->inter_base = &ivi4_quant_4x4_inter[quant_index_to_tab[band->quant_mat]][0];\n    }\n    band->intra_scale = NULL;\n    band->inter_scale = NULL;\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}']