libavcodec/wmalosslessdec.c:929: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`.

libavcodec/wmalosslessdec.c:908:29: Call
906.             return res;
907.         s->movave_scaling = bitstream_read(&s->bc, 3);
908.         s->quant_stepsize = bitstream_read(&s->bc, 8) + 1;
                                 ^
909. 
910.         reset_codec(s);

libavcodec/bitstream.h:183:1: Parameter `bc->bits_left`
  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/wmalosslessdec.c:918:19: Call
916.     }
917. 
918.     rawpcm_tile = bitstream_read_bit(&s->bc);
                       ^
919. 
920.     for (i = 0; i < s->num_channels; i++)

libavcodec/bitstream.h:145:1: Parameter `bc->bits_left`
  143. 
  144. /* Return one bit from the buffer. */
  145. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
       ^
  146. {
  147.     if (!bc->bits_left)

libavcodec/bitstream.h:150:12: Call
  148.         refill_64(bc);
  149. 
  150.     return get_val(bc, 1);
                  ^
  151. }
  152. 

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: Assignment
    137.     bc->bits <<= n;
    138. #endif
    139.     bc->bits_left -= n;
             ^
    140. 
    141.     return ret;

libavcodec/wmalosslessdec.c:929:25: Call
927.         if (s->bV3RTM) {
928.             // LPC
929.             s->do_lpc = bitstream_read_bit(&s->bc);
                             ^
930.             if (s->do_lpc) {
931.                 decode_lpc(s);

libavcodec/bitstream.h:145:1: Parameter `bc->bits_left`
  143. 
  144. /* Return one bit from the buffer. */
  145. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
       ^
  146. {
  147.     if (!bc->bits_left)

libavcodec/bitstream.h:150:12: Call
  148.         refill_64(bc);
  149. 
  150.     return get_val(bc, 1);
                  ^
  151. }
  152. 

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: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 
    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_subframe(WmallDecodeCtx *s)\n{\n    int offset        = s->samples_per_frame;\n    int subframe_len  = s->samples_per_frame;\n    int total_samples = s->samples_per_frame * s->num_channels;\n    int i, j, rawpcm_tile, padding_zeroes, res;\n    s->subframe_offset = bitstream_tell(&s->bc);\n    for (i = 0; i < s->num_channels; i++) {\n        if (offset > s->channel[i].decoded_samples) {\n            offset = s->channel[i].decoded_samples;\n            subframe_len =\n                s->channel[i].subframe_len[s->channel[i].cur_subframe];\n        }\n    }\n    s->channels_for_cur_subframe = 0;\n    for (i = 0; i < s->num_channels; i++) {\n        const int cur_subframe = s->channel[i].cur_subframe;\n        total_samples -= s->channel[i].decoded_samples;\n        if (offset == s->channel[i].decoded_samples &&\n            subframe_len == s->channel[i].subframe_len[cur_subframe]) {\n            total_samples -= s->channel[i].subframe_len[cur_subframe];\n            s->channel[i].decoded_samples +=\n                s->channel[i].subframe_len[cur_subframe];\n            s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;\n            ++s->channels_for_cur_subframe;\n        }\n    }\n    if (!total_samples)\n        s->parsed_all_subframes = 1;\n    s->seekable_tile = bitstream_read_bit(&s->bc);\n    if (s->seekable_tile) {\n        clear_codec_buffers(s);\n        s->do_arith_coding    = bitstream_read_bit(&s->bc);\n        if (s->do_arith_coding) {\n            avpriv_request_sample(s->avctx, "Arithmetic coding");\n            return AVERROR_PATCHWELCOME;\n        }\n        s->do_ac_filter       = bitstream_read_bit(&s->bc);\n        s->do_inter_ch_decorr = bitstream_read_bit(&s->bc);\n        s->do_mclms           = bitstream_read_bit(&s->bc);\n        if (s->do_ac_filter)\n            decode_ac_filter(s);\n        if (s->do_mclms)\n            decode_mclms(s);\n        if ((res = decode_cdlms(s)) < 0)\n            return res;\n        s->movave_scaling = bitstream_read(&s->bc, 3);\n        s->quant_stepsize = bitstream_read(&s->bc, 8) + 1;\n        reset_codec(s);\n    } else if (!s->cdlms[0][0].order) {\n        av_log(s->avctx, AV_LOG_DEBUG,\n               "Waiting for seekable tile\\n");\n        av_frame_unref(s->frame);\n        return -1;\n    }\n    rawpcm_tile = bitstream_read_bit(&s->bc);\n    for (i = 0; i < s->num_channels; i++)\n        s->is_channel_coded[i] = 1;\n    if (!rawpcm_tile) {\n        for (i = 0; i < s->num_channels; i++)\n            s->is_channel_coded[i] = bitstream_read_bit(&s->bc);\n        if (s->bV3RTM) {\n            s->do_lpc = bitstream_read_bit(&s->bc);\n            if (s->do_lpc) {\n                decode_lpc(s);\n                avpriv_request_sample(s->avctx, "Expect wrong output since "\n                                      "inverse LPC filter");\n            }\n        } else\n            s->do_lpc = 0;\n    }\n    if (bitstream_read_bit(&s->bc))\n        padding_zeroes = bitstream_read(&s->bc, 5);\n    else\n        padding_zeroes = 0;\n    if (rawpcm_tile) {\n        int bits = s->bits_per_sample - padding_zeroes;\n        if (bits <= 0) {\n            av_log(s->avctx, AV_LOG_ERROR,\n                   "Invalid number of padding bits in raw PCM tile\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        ff_dlog(s->avctx, "RAWPCM %d bits per sample. "\n                "total %d bits, remain=%d\\n", bits,\n                bits * s->num_channels * subframe_len, bitstream_tell(&s->bc));\n        for (i = 0; i < s->num_channels; i++)\n            for (j = 0; j < subframe_len; j++)\n                s->channel_coeffs[i][j] = bitstream_read_signed(&s->bc, bits);\n    } else {\n        for (i = 0; i < s->num_channels; i++)\n            if (s->is_channel_coded[i]) {\n                decode_channel_residues(s, i, subframe_len);\n                if (s->seekable_tile)\n                    use_high_update_speed(s, i);\n                else\n                    use_normal_update_speed(s, i);\n                revert_cdlms(s, i, 0, subframe_len);\n            } else {\n                memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len);\n            }\n    }\n    if (s->do_mclms)\n        revert_mclms(s, subframe_len);\n    if (s->do_inter_ch_decorr)\n        revert_inter_ch_decorr(s, subframe_len);\n    if (s->do_ac_filter)\n        revert_acfilter(s, subframe_len);\n    if (s->quant_stepsize != 1)\n        for (i = 0; i < s->num_channels; i++)\n            for (j = 0; j < subframe_len; j++)\n                s->channel_residues[i][j] *= s->quant_stepsize;\n    for (i = 0; i < s->channels_for_cur_subframe; i++) {\n        int c = s->channel_indexes_for_cur_subframe[i];\n        int subframe_len = s->channel[c].subframe_len[s->channel[c].cur_subframe];\n        for (j = 0; j < subframe_len; j++) {\n            if (s->bits_per_sample == 16) {\n                *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes;\n            } else {\n                *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes;\n            }\n        }\n    }\n    for (i = 0; i < s->channels_for_cur_subframe; i++) {\n        int c = s->channel_indexes_for_cur_subframe[i];\n        if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) {\n            av_log(s->avctx, AV_LOG_ERROR, "broken subframe\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        ++s->channel[c].cur_subframe;\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 unsigned bitstream_read_bit(BitstreamContext *bc)\n{\n    if (!bc->bits_left)\n        refill_64(bc);\n    return get_val(bc, 1);\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}']