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

libavcodec/truemotion2.c:150:21: Call
148.     huff.max_bits = bitstream_read(&ctx->bc, 5);
149.     huff.min_bits = bitstream_read(&ctx->bc, 5);
150.     huff.nodes    = bitstream_read(&ctx->bc, 17);
                         ^
151.     huff.num      = 0;
152. 

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] - 17):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 tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)\n{\n    TM2Huff huff;\n    int res = 0;\n    huff.val_bits = bitstream_read(&ctx->bc, 5);\n    huff.max_bits = bitstream_read(&ctx->bc, 5);\n    huff.min_bits = bitstream_read(&ctx->bc, 5);\n    huff.nodes    = bitstream_read(&ctx->bc, 17);\n    huff.num      = 0;\n    if ((huff.val_bits < 1) || (huff.val_bits > 32) ||\n        (huff.max_bits < 0) || (huff.max_bits > 25)) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal "\n               "length: %i, max code length: %i\\n", huff.val_bits, huff.max_bits);\n        return AVERROR_INVALIDDATA;\n    }\n    if ((huff.nodes <= 0) || (huff.nodes > 0x10000)) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree "\n               "nodes: %i\\n", huff.nodes);\n        return AVERROR_INVALIDDATA;\n    }\n    if (huff.max_bits == 0)\n        huff.max_bits = 1;\n    huff.max_num = (huff.nodes + 1) >> 1;\n    huff.nums    = av_mallocz(huff.max_num * sizeof(int));\n    huff.bits    = av_mallocz(huff.max_num * sizeof(uint32_t));\n    huff.lens    = av_mallocz(huff.max_num * sizeof(int));\n    if (!huff.nums || !huff.bits || !huff.lens) {\n        res = AVERROR(ENOMEM);\n        goto out;\n    }\n    res = tm2_read_tree(ctx, 0, 0, &huff);\n    if (huff.num != huff.max_num) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\\n",\n               huff.num, huff.max_num);\n        res = AVERROR_INVALIDDATA;\n    }\n    if (res >= 0) {\n        int i;\n        res = init_vlc(&code->vlc, huff.max_bits, huff.max_num,\n                       huff.lens, sizeof(int), sizeof(int),\n                       huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);\n        if (res < 0)\n            av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\\n");\n        else {\n            code->bits = huff.max_bits;\n            code->length = huff.max_num;\n            code->recode = av_malloc(code->length * sizeof(int));\n            if (!code->recode) {\n                res = AVERROR(ENOMEM);\n                goto out;\n            }\n            for (i = 0; i < code->length; i++)\n                code->recode[i] = huff.nums[i];\n        }\n    }\nout:\n    av_free(huff.nums);\n    av_free(huff.bits);\n    av_free(huff.lens);\n    return res;\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}']