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

libavcodec/indeo5.c:68:48: Call
66.     ctx->gop_flags = bitstream_read(&ctx->bc, 8);
67. 
68.     ctx->gop_hdr_size = (ctx->gop_flags & 1) ? bitstream_read(&ctx->bc, 16) : 0;
                                                   ^
69. 
70.     if (ctx->gop_flags & IVI5_IS_PROTECTED)

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] - 16):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_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)\n{\n    int             result, i, p, tile_size, pic_size_indx, mb_size, blk_size;\n    int             quant_mat, blk_size_changed = 0;\n    IVIBandDesc     *band, *band1, *band2;\n    IVIPicConfig    pic_conf;\n    ctx->gop_flags = bitstream_read(&ctx->bc, 8);\n    ctx->gop_hdr_size = (ctx->gop_flags & 1) ? bitstream_read(&ctx->bc, 16) : 0;\n    if (ctx->gop_flags & IVI5_IS_PROTECTED)\n        ctx->lock_word = bitstream_read(&ctx->bc, 32);\n    tile_size = (ctx->gop_flags & 0x40) ? 64 << bitstream_read(&ctx->bc, 2) : 0;\n    if (tile_size > 256) {\n        av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\\n", tile_size);\n        return AVERROR_INVALIDDATA;\n    }\n    pic_conf.luma_bands   = bitstream_read(&ctx->bc, 2)  * 3 + 1;\n    pic_conf.chroma_bands = bitstream_read_bit(&ctx->bc) * 3 + 1;\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    pic_size_indx = bitstream_read(&ctx->bc, 4);\n    if (pic_size_indx == IVI5_PIC_SIZE_ESC) {\n        pic_conf.pic_height = bitstream_read(&ctx->bc, 13);\n        pic_conf.pic_width  = bitstream_read(&ctx->bc, 13);\n    } else {\n        pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2;\n        pic_conf.pic_width  = ivi5_common_pic_sizes[pic_size_indx * 2    ] << 2;\n    }\n    if (ctx->gop_flags & 2) {\n        avpriv_report_missing_feature(avctx, "YV12 picture format");\n        return AVERROR_PATCHWELCOME;\n    }\n    pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;\n    pic_conf.chroma_width  = (pic_conf.pic_width  + 3) >> 2;\n    if (!tile_size) {\n        pic_conf.tile_height = pic_conf.pic_height;\n        pic_conf.tile_width  = pic_conf.pic_width;\n    } else {\n        pic_conf.tile_height = pic_conf.tile_width = tile_size;\n    }\n    if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf) || ctx->gop_invalid) {\n        result = ff_ivi_init_planes(ctx->planes, &pic_conf, 0);\n        if (result < 0) {\n            av_log(avctx, AV_LOG_ERROR, "Couldn\'t reallocate color planes!\\n");\n            return result;\n        }\n        ctx->pic_conf = pic_conf;\n        blk_size_changed = 1;\n    }\n    for (p = 0; p <= 1; p++) {\n        for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {\n            band = &ctx->planes[p].bands[i];\n            band->is_halfpel = bitstream_read_bit(&ctx->bc);\n            mb_size  = bitstream_read_bit(&ctx->bc);\n            blk_size = 8 >> bitstream_read_bit(&ctx->bc);\n            mb_size  = blk_size << !mb_size;\n            blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size;\n            if (blk_size_changed) {\n                band->mb_size  = mb_size;\n                band->blk_size = blk_size;\n            }\n            if (bitstream_read_bit(&ctx->bc)) {\n                avpriv_report_missing_feature(avctx, "Extended transform info");\n                return AVERROR_PATCHWELCOME;\n            }\n            switch ((p << 2) + i) {\n            case 0:\n                band->inv_transform  = ff_ivi_inverse_slant_8x8;\n                band->dc_transform   = ff_ivi_dc_slant_2d;\n                band->scan           = ff_zigzag_direct;\n                band->transform_size = 8;\n                break;\n            case 1:\n                band->inv_transform  = ff_ivi_row_slant8;\n                band->dc_transform   = ff_ivi_dc_row_slant;\n                band->scan           = ff_ivi_vertical_scan_8x8;\n                band->transform_size = 8;\n                break;\n            case 2:\n                band->inv_transform  = ff_ivi_col_slant8;\n                band->dc_transform   = ff_ivi_dc_col_slant;\n                band->scan           = ff_ivi_horizontal_scan_8x8;\n                band->transform_size = 8;\n                break;\n            case 3:\n                band->inv_transform  = ff_ivi_put_pixels_8x8;\n                band->dc_transform   = ff_ivi_put_dc_pixel_8x8;\n                band->scan           = ff_ivi_horizontal_scan_8x8;\n                band->transform_size = 8;\n                break;\n            case 4:\n                band->inv_transform  = ff_ivi_inverse_slant_4x4;\n                band->dc_transform   = ff_ivi_dc_slant_2d;\n                band->scan           = ff_ivi_direct_scan_4x4;\n                band->transform_size = 4;\n                break;\n            }\n            band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||\n                                band->inv_transform == ff_ivi_inverse_slant_4x4;\n            if (band->transform_size != band->blk_size)\n                return AVERROR_INVALIDDATA;\n            if (!p) {\n                quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;\n            } else {\n                quant_mat = 5;\n            }\n            if (band->blk_size == 8) {\n                band->intra_base  = &ivi5_base_quant_8x8_intra[quant_mat][0];\n                band->inter_base  = &ivi5_base_quant_8x8_inter[quant_mat][0];\n                band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0];\n                band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0];\n            } else {\n                band->intra_base  = ivi5_base_quant_4x4_intra;\n                band->inter_base  = ivi5_base_quant_4x4_inter;\n                band->intra_scale = ivi5_scale_quant_4x4_intra;\n                band->inter_scale = ivi5_scale_quant_4x4_inter;\n            }\n            if (bitstream_read(&ctx->bc, 2)) {\n                av_log(avctx, AV_LOG_ERROR, "End marker missing!\\n");\n                return AVERROR_INVALIDDATA;\n            }\n        }\n    }\n    for (i = 0; i < pic_conf.chroma_bands; i++) {\n        band1 = &ctx->planes[1].bands[i];\n        band2 = &ctx->planes[2].bands[i];\n        band2->width         = band1->width;\n        band2->height        = band1->height;\n        band2->mb_size       = band1->mb_size;\n        band2->blk_size      = band1->blk_size;\n        band2->is_halfpel    = band1->is_halfpel;\n        band2->intra_base    = band1->intra_base;\n        band2->inter_base    = band1->inter_base;\n        band2->intra_scale   = band1->intra_scale;\n        band2->inter_scale   = band1->inter_scale;\n        band2->scan          = band1->scan;\n        band2->inv_transform = band1->inv_transform;\n        band2->dc_transform  = band1->dc_transform;\n        band2->is_2d_trans   = band1->is_2d_trans;\n    }\n    if (blk_size_changed) {\n        result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width,\n                                   pic_conf.tile_height);\n        if (result < 0) {\n            av_log(avctx, AV_LOG_ERROR,\n                   "Couldn\'t reallocate internal structures!\\n");\n            return result;\n        }\n    }\n    if (ctx->gop_flags & 8) {\n        if (bitstream_read(&ctx->bc, 3)) {\n            av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        if (bitstream_read_bit(&ctx->bc))\n            bitstream_skip(&ctx->bc, 24);\n    }\n    bitstream_align(&ctx->bc);\n    bitstream_skip(&ctx->bc, 23);\n    if (bitstream_read_bit(&ctx->bc)) {\n        do {\n            i = bitstream_read(&ctx->bc, 16);\n        } while (i & 0x8000);\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}']