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

libavcodec/atrac3plus.c:347:13: Call
345.     chan->fill_mode = 0;
346. 
347.     switch (bitstream_read(bc, 2)) { /* switch according to coding mode */
                 ^
348.     case 0: /* coded using constant number of bits */
349.         for (i = 0; i < ctx->num_quant_units; i++)

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/atrac3plus.c:456:44: Call
454.     if (chan->fill_mode == 2) {
455.         for (i = chan->num_coded_vals; i < ctx->num_quant_units; i++)
456.             chan->qu_wordlen[i] = ch_num ? bitstream_read_bit(bc) : 1;
                                                ^
457.     } else if (chan->fill_mode == 3) {
458.         pos = ch_num ? chan->num_coded_vals + chan->split_point

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_channel_wordlen(BitstreamContext *bc, Atrac3pChanUnitCtx *ctx,\n                                  int ch_num, AVCodecContext *avctx)\n{\n    int i, weight_idx = 0, delta, diff, pos, delta_bits, min_val, flag,\n        ret, start_val;\n    VLC *vlc_tab;\n    Atrac3pChanParams *chan     = &ctx->channels[ch_num];\n    Atrac3pChanParams *ref_chan = &ctx->channels[0];\n    chan->fill_mode = 0;\n    switch (bitstream_read(bc, 2)) {\n    case 0:\n        for (i = 0; i < ctx->num_quant_units; i++)\n            chan->qu_wordlen[i] = bitstream_read(bc, 3);\n        break;\n    case 1:\n        if (ch_num) {\n            if ((ret = num_coded_units(bc, chan, ctx, avctx)) < 0)\n                return ret;\n            if (chan->num_coded_vals) {\n                vlc_tab = &wl_vlc_tabs[bitstream_read(bc, 2)];\n                for (i = 0; i < chan->num_coded_vals; i++) {\n                    delta = bitstream_read_vlc(bc, vlc_tab->table, vlc_tab->bits, 1);\n                    chan->qu_wordlen[i] = (ref_chan->qu_wordlen[i] + delta) & 7;\n                }\n            }\n        } else {\n            weight_idx = bitstream_read(bc, 2);\n            if ((ret = num_coded_units(bc, chan, ctx, avctx)) < 0)\n                return ret;\n            if (chan->num_coded_vals) {\n                pos = bitstream_read(bc, 5);\n                if (pos > chan->num_coded_vals) {\n                    av_log(avctx, AV_LOG_ERROR,\n                           "WL mode 1: invalid position!\\n");\n                    return AVERROR_INVALIDDATA;\n                }\n                delta_bits = bitstream_read(bc, 2);\n                min_val    = bitstream_read(bc, 3);\n                for (i = 0; i < pos; i++)\n                    chan->qu_wordlen[i] = bitstream_read(bc, 3);\n                for (i = pos; i < chan->num_coded_vals; i++)\n                    chan->qu_wordlen[i] = (min_val + bitstream_read(bc, delta_bits)) & 7;\n            }\n        }\n        break;\n    case 2:\n        if ((ret = num_coded_units(bc, chan, ctx, avctx)) < 0)\n            return ret;\n        if (ch_num && chan->num_coded_vals) {\n            vlc_tab = &wl_vlc_tabs[bitstream_read(bc, 2)];\n            delta = bitstream_read_vlc(bc, vlc_tab->table, vlc_tab->bits, 1);\n            chan->qu_wordlen[0] = (ref_chan->qu_wordlen[0] + delta) & 7;\n            for (i = 1; i < chan->num_coded_vals; i++) {\n                diff = ref_chan->qu_wordlen[i] - ref_chan->qu_wordlen[i - 1];\n                delta = bitstream_read_vlc(bc, vlc_tab->table, vlc_tab->bits, 1);\n                chan->qu_wordlen[i] = (chan->qu_wordlen[i - 1] + diff + delta) & 7;\n            }\n        } else if (chan->num_coded_vals) {\n            flag    = bitstream_read(bc, 1);\n            vlc_tab = &wl_vlc_tabs[bitstream_read(bc, 1)];\n            start_val = bitstream_read(bc, 3);\n            unpack_vq_shape(start_val,\n                            &atrac3p_wl_shapes[start_val][bitstream_read(bc, 4)][0],\n                            chan->qu_wordlen, chan->num_coded_vals);\n            if (!flag) {\n                for (i = 0; i < chan->num_coded_vals; i++) {\n                    delta = bitstream_read_vlc(bc, vlc_tab->table, vlc_tab->bits, 1);\n                    chan->qu_wordlen[i] = (chan->qu_wordlen[i] + delta) & 7;\n                }\n            } else {\n                for (i = 0; i < (chan->num_coded_vals & - 2); i += 2)\n                    if (!bitstream_read_bit(bc)) {\n                        chan->qu_wordlen[i]     = (chan->qu_wordlen[i] +\n                                                   bitstream_read_vlc(bc, vlc_tab->table,\n                                                                      vlc_tab->bits, 1)) & 7;\n                        chan->qu_wordlen[i + 1] = (chan->qu_wordlen[i + 1] +\n                                                   bitstream_read_vlc(bc, vlc_tab->table,\n                                                                      vlc_tab->bits, 1)) & 7;\n                    }\n                if (chan->num_coded_vals & 1)\n                    chan->qu_wordlen[i] = (chan->qu_wordlen[i] +\n                                           bitstream_read_vlc(bc, vlc_tab->table,\n                                                              vlc_tab->bits, 1)) & 7;\n            }\n        }\n        break;\n    case 3:\n        weight_idx = bitstream_read(bc, 2);\n        if ((ret = num_coded_units(bc, chan, ctx, avctx)) < 0)\n            return ret;\n        if (chan->num_coded_vals) {\n            vlc_tab = &wl_vlc_tabs[bitstream_read(bc, 2)];\n            chan->qu_wordlen[0] = bitstream_read(bc, 3);\n            for (i = 1; i < chan->num_coded_vals; i++) {\n                delta = bitstream_read_vlc(bc, vlc_tab->table, vlc_tab->bits, 1);\n                chan->qu_wordlen[i] = (chan->qu_wordlen[i - 1] + delta) & 7;\n            }\n        }\n        break;\n    }\n    if (chan->fill_mode == 2) {\n        for (i = chan->num_coded_vals; i < ctx->num_quant_units; i++)\n            chan->qu_wordlen[i] = ch_num ? bitstream_read_bit(bc) : 1;\n    } else if (chan->fill_mode == 3) {\n        pos = ch_num ? chan->num_coded_vals + chan->split_point\n                     : ctx->num_quant_units - chan->split_point;\n        for (i = chan->num_coded_vals; i < pos; i++)\n            chan->qu_wordlen[i] = 1;\n    }\n    if (weight_idx)\n        return add_wordlen_weights(ctx, chan, weight_idx, avctx);\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}']