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

libavcodec/wmadec.c:503:23: Call
501.     total_gain = 1;
502.     for (;;) {
503.         a           = bitstream_read(&s->bc, 7);
                           ^
504.         total_gain += a;
505.         if (a != 127)

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/wmadec.c:560:53: Call
558. 
559.     /* exponents can be reused in short blocks. */
560.     if ((s->block_len_bits == s->frame_len_bits) || bitstream_read_bit(&s->bc)) {
                                                         ^
561.         for (ch = 0; ch < s->avctx->channels; ch++) {
562.             if (s->channel_coded[ch]) {

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 wma_decode_block(WMACodecContext *s)\n{\n    int n, v, a, ch, bsize;\n    int coef_nb_bits, total_gain;\n    int nb_coefs[MAX_CHANNELS];\n    float mdct_norm;\n    FFTContext *mdct;\n#ifdef TRACE\n    ff_tlog(s->avctx, "***decode_block: %d:%d\\n",\n            s->frame_count - 1, s->block_num);\n#endif\n    if (s->use_variable_block_len) {\n        n = av_log2(s->nb_block_sizes - 1) + 1;\n        if (s->reset_block_lengths) {\n            s->reset_block_lengths = 0;\n            v                      = bitstream_read(&s->bc, n);\n            if (v >= s->nb_block_sizes) {\n                av_log(s->avctx, AV_LOG_ERROR,\n                       "prev_block_len_bits %d out of range\\n",\n                       s->frame_len_bits - v);\n                return -1;\n            }\n            s->prev_block_len_bits = s->frame_len_bits - v;\n            v                      = bitstream_read(&s->bc, n);\n            if (v >= s->nb_block_sizes) {\n                av_log(s->avctx, AV_LOG_ERROR,\n                       "block_len_bits %d out of range\\n",\n                       s->frame_len_bits - v);\n                return -1;\n            }\n            s->block_len_bits = s->frame_len_bits - v;\n        } else {\n            s->prev_block_len_bits = s->block_len_bits;\n            s->block_len_bits      = s->next_block_len_bits;\n        }\n        v = bitstream_read(&s->bc, n);\n        if (v >= s->nb_block_sizes) {\n            av_log(s->avctx, AV_LOG_ERROR,\n                   "next_block_len_bits %d out of range\\n",\n                   s->frame_len_bits - v);\n            return -1;\n        }\n        s->next_block_len_bits = s->frame_len_bits - v;\n    } else {\n        s->next_block_len_bits = s->frame_len_bits;\n        s->prev_block_len_bits = s->frame_len_bits;\n        s->block_len_bits      = s->frame_len_bits;\n    }\n    s->block_len = 1 << s->block_len_bits;\n    if ((s->block_pos + s->block_len) > s->frame_len) {\n        av_log(s->avctx, AV_LOG_ERROR, "frame_len overflow\\n");\n        return -1;\n    }\n    if (s->avctx->channels == 2)\n        s->ms_stereo = bitstream_read_bit(&s->bc);\n    v = 0;\n    for (ch = 0; ch < s->avctx->channels; ch++) {\n        a                    = bitstream_read_bit(&s->bc);\n        s->channel_coded[ch] = a;\n        v                   |= a;\n    }\n    bsize = s->frame_len_bits - s->block_len_bits;\n    if (!v)\n        goto next;\n    total_gain = 1;\n    for (;;) {\n        a           = bitstream_read(&s->bc, 7);\n        total_gain += a;\n        if (a != 127)\n            break;\n    }\n    coef_nb_bits = ff_wma_total_gain_to_bits(total_gain);\n    n = s->coefs_end[bsize] - s->coefs_start;\n    for (ch = 0; ch < s->avctx->channels; ch++)\n        nb_coefs[ch] = n;\n    if (s->use_noise_coding) {\n        for (ch = 0; ch < s->avctx->channels; ch++) {\n            if (s->channel_coded[ch]) {\n                int i, n, a;\n                n = s->exponent_high_sizes[bsize];\n                for (i = 0; i < n; i++) {\n                    a                         = bitstream_read_bit(&s->bc);\n                    s->high_band_coded[ch][i] = a;\n                    if (a)\n                        nb_coefs[ch] -= s->exponent_high_bands[bsize][i];\n                }\n            }\n        }\n        for (ch = 0; ch < s->avctx->channels; ch++) {\n            if (s->channel_coded[ch]) {\n                int i, n, val, code;\n                n   = s->exponent_high_sizes[bsize];\n                val = (int) 0x80000000;\n                for (i = 0; i < n; i++) {\n                    if (s->high_band_coded[ch][i]) {\n                        if (val == (int) 0x80000000) {\n                            val = bitstream_read(&s->bc, 7) - 19;\n                        } else {\n                            code = bitstream_read_vlc(&s->bc,\n                                                      s->hgain_vlc.table,\n                                                      HGAINVLCBITS, HGAINMAX);\n                            if (code < 0) {\n                                av_log(s->avctx, AV_LOG_ERROR,\n                                       "hgain vlc invalid\\n");\n                                return -1;\n                            }\n                            val += code - 18;\n                        }\n                        s->high_band_values[ch][i] = val;\n                    }\n                }\n            }\n        }\n    }\n    if ((s->block_len_bits == s->frame_len_bits) || bitstream_read_bit(&s->bc)) {\n        for (ch = 0; ch < s->avctx->channels; ch++) {\n            if (s->channel_coded[ch]) {\n                if (s->use_exp_vlc) {\n                    if (decode_exp_vlc(s, ch) < 0)\n                        return -1;\n                } else {\n                    decode_exp_lsp(s, ch);\n                }\n                s->exponents_bsize[ch] = bsize;\n            }\n        }\n    }\n    for (ch = 0; ch < s->avctx->channels; ch++) {\n        if (s->channel_coded[ch]) {\n            int tindex;\n            WMACoef *ptr = &s->coefs1[ch][0];\n            tindex = (ch == 1 && s->ms_stereo);\n            memset(ptr, 0, s->block_len * sizeof(WMACoef));\n            ff_wma_run_level_decode(s->avctx, &s->bc, &s->coef_vlc[tindex],\n                                    s->level_table[tindex], s->run_table[tindex],\n                                    0, ptr, 0, nb_coefs[ch],\n                                    s->block_len, s->frame_len_bits, coef_nb_bits);\n        }\n        if (s->version == 1 && s->avctx->channels >= 2)\n            bitstream_align(&s->bc);\n    }\n    {\n        int n4 = s->block_len / 2;\n        mdct_norm = 1.0 / (float) n4;\n        if (s->version == 1)\n            mdct_norm *= sqrt(n4);\n    }\n    for (ch = 0; ch < s->avctx->channels; ch++) {\n        if (s->channel_coded[ch]) {\n            WMACoef *coefs1;\n            float *coefs, *exponents, mult, mult1, noise;\n            int i, j, n, n1, last_high_band, esize;\n            float exp_power[HIGH_BAND_MAX_SIZE];\n            coefs1    = s->coefs1[ch];\n            exponents = s->exponents[ch];\n            esize     = s->exponents_bsize[ch];\n            mult      = pow(10, total_gain * 0.05) / s->max_exponent[ch];\n            mult     *= mdct_norm;\n            coefs     = s->coefs[ch];\n            if (s->use_noise_coding) {\n                mult1 = mult;\n                for (i = 0; i < s->coefs_start; i++) {\n                    *coefs++ = s->noise_table[s->noise_index] *\n                               exponents[i << bsize >> esize] * mult1;\n                    s->noise_index = (s->noise_index + 1) &\n                                     (NOISE_TAB_SIZE - 1);\n                }\n                n1 = s->exponent_high_sizes[bsize];\n                exponents = s->exponents[ch] +\n                            (s->high_band_start[bsize] << bsize >> esize);\n                last_high_band = 0;\n                for (j = 0; j < n1; j++) {\n                    n = s->exponent_high_bands[s->frame_len_bits -\n                                               s->block_len_bits][j];\n                    if (s->high_band_coded[ch][j]) {\n                        float e2, v;\n                        e2 = 0;\n                        for (i = 0; i < n; i++) {\n                            v   = exponents[i << bsize >> esize];\n                            e2 += v * v;\n                        }\n                        exp_power[j]   = e2 / n;\n                        last_high_band = j;\n                        ff_tlog(s->avctx, "%d: power=%f (%d)\\n", j, exp_power[j], n);\n                    }\n                    exponents += n << bsize >> esize;\n                }\n                exponents = s->exponents[ch] + (s->coefs_start << bsize >> esize);\n                for (j = -1; j < n1; j++) {\n                    if (j < 0)\n                        n = s->high_band_start[bsize] - s->coefs_start;\n                    else\n                        n = s->exponent_high_bands[s->frame_len_bits -\n                                                   s->block_len_bits][j];\n                    if (j >= 0 && s->high_band_coded[ch][j]) {\n                        mult1 = sqrt(exp_power[j] / exp_power[last_high_band]);\n                        mult1  = mult1 * pow(10, s->high_band_values[ch][j] * 0.05);\n                        mult1  = mult1 / (s->max_exponent[ch] * s->noise_mult);\n                        mult1 *= mdct_norm;\n                        for (i = 0; i < n; i++) {\n                            noise          = s->noise_table[s->noise_index];\n                            s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);\n                            *coefs++       = noise * exponents[i << bsize >> esize] * mult1;\n                        }\n                        exponents += n << bsize >> esize;\n                    } else {\n                        for (i = 0; i < n; i++) {\n                            noise          = s->noise_table[s->noise_index];\n                            s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);\n                            *coefs++       = ((*coefs1++) + noise) *\n                                             exponents[i << bsize >> esize] * mult;\n                        }\n                        exponents += n << bsize >> esize;\n                    }\n                }\n                n     = s->block_len - s->coefs_end[bsize];\n                mult1 = mult * exponents[((-1 << bsize)) >> esize];\n                for (i = 0; i < n; i++) {\n                    *coefs++       = s->noise_table[s->noise_index] * mult1;\n                    s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);\n                }\n            } else {\n                for (i = 0; i < s->coefs_start; i++)\n                    *coefs++ = 0.0;\n                n = nb_coefs[ch];\n                for (i = 0; i < n; i++)\n                    *coefs++ = coefs1[i] * exponents[i << bsize >> esize] * mult;\n                n = s->block_len - s->coefs_end[bsize];\n                for (i = 0; i < n; i++)\n                    *coefs++ = 0.0;\n            }\n        }\n    }\n#ifdef TRACE\n    for (ch = 0; ch < s->avctx->channels; ch++) {\n        if (s->channel_coded[ch]) {\n            dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len);\n            dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len);\n        }\n    }\n#endif\n    if (s->ms_stereo && s->channel_coded[1]) {\n        if (!s->channel_coded[0]) {\n            ff_tlog(s->avctx, "rare ms-stereo case happened\\n");\n            memset(s->coefs[0], 0, sizeof(float) * s->block_len);\n            s->channel_coded[0] = 1;\n        }\n        s->fdsp.butterflies_float(s->coefs[0], s->coefs[1], s->block_len);\n    }\nnext:\n    mdct = &s->mdct_ctx[bsize];\n    for (ch = 0; ch < s->avctx->channels; ch++) {\n        int n4, index;\n        n4 = s->block_len / 2;\n        if (s->channel_coded[ch])\n            mdct->imdct_calc(mdct, s->output, s->coefs[ch]);\n        else if (!(s->ms_stereo && ch == 1))\n            memset(s->output, 0, sizeof(s->output));\n        index = (s->frame_len / 2) + s->block_pos - n4;\n        wma_window(s, &s->frame_out[ch][index]);\n    }\n    s->block_num++;\n    s->block_pos += s->block_len;\n    if (s->block_pos >= s->frame_len)\n        return 1;\n    else\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}']