libavcodec/alsdec.c:1426: error: Integer Overflow L2
  ([-3, +oo] - 5):unsigned32 by call to `read_block`.

libavcodec/alsdec.c:1402:9: Call
1400.         bd.prev_raw_samples = ctx->prev_raw_samples;
1401. 
1402.         get_block_sizes(ctx, div_blocks, &bs_info);
              ^
1403. 
1404.         for (b = 0; b < ctx->num_blocks; b++) {

libavcodec/alsdec.c:504:1: Parameter `ctx->bc.bits_left`
  502.  *  actual number of samples.
  503.  */
  504. static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks,
       ^
  505.                             uint32_t *bs_info)
  506. {

libavcodec/alsdec.c:1426:28: Call
1424.                 bd.raw_other   = NULL;
1425. 
1426.                 if ((ret = read_block(ctx, &bd)) < 0)
                                 ^
1427.                     return ret;
1428.                 if ((ret = read_channel_data(ctx, ctx->chan_data[c], c)) < 0)

libavcodec/alsdec.c:968:1: Parameter `ctx->bc.bits_left`
  966. /** Read the block data.
  967.  */
  968. static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
       ^
  969. {
  970.     int ret = 0;

libavcodec/alsdec.c:975:9: Call
  973.     *bd->shift_lsbs = 0;
  974.     // read block type flag and read the samples accordingly
  975.     if (bitstream_read_bit(bc)) {
               ^
  976.         ret = read_var_block_data(ctx, bd);
  977.     } else {

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/alsdec.c:978:9: Call
  976.         ret = read_var_block_data(ctx, bd);
  977.     } else {
  978.         read_const_block_data(ctx, bd);
               ^
  979.     }
  980. 

libavcodec/alsdec.c:557:1: Parameter `ctx->bc.bits_left`
    555. /** Read the block data for a constant block
    556.  */
    557. static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
         ^
    558. {
    559.     ALSSpecificConfig *sconf = &ctx->sconf;

libavcodec/alsdec.c:564:24: Call
    562. 
    563.     *bd->raw_samples = 0;
    564.     *bd->const_block = bitstream_read_bit(bc);  // 1 = constant value, 0 = zero block (silence)
                                ^
    565.     bd->js_blocks    = bitstream_read_bit(bc);
    566. 

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/alsdec.c:565:24: Call
    563.     *bd->raw_samples = 0;
    564.     *bd->const_block = bitstream_read_bit(bc);  // 1 = constant value, 0 = zero block (silence)
    565.     bd->js_blocks    = bitstream_read_bit(bc);
                                ^
    566. 
    567.     // skip 5 reserved bits

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/alsdec.c:568:5: Call
    566. 
    567.     // skip 5 reserved bits
    568.     bitstream_skip(bc, 5);
             ^
    569. 
    570.     if (*bd->const_block) {

libavcodec/bitstream.h:241:1: Parameter `n`
      239. 
      240. /* Skip n bits in the buffer. */
      241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
           ^
      242. {
      243.     if (n <= bc->bits_left)

libavcodec/bitstream.h:244:9: Call
      242. {
      243.     if (n <= bc->bits_left)
      244.         skip_remaining(bc, n);
                   ^
      245.     else {
      246.         n -= bc->bits_left;

libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
        228. }
        229. 
        230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
             ^
        231. {
        232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `n`
        228. }
        229. 
        230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
             ^
        231. {
        232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:237:5: Binary operation: ([-3, +oo] - 5):unsigned32 by call to `read_block` 
        235.     bc->bits <<= n;
        236. #endif
        237.     bc->bits_left -= n;
                 ^
        238. }
        239. 

static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    bc->bits >>= n;
#else
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
}
['static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)\n{\n    ALSSpecificConfig *sconf = &ctx->sconf;\n    AVCodecContext *avctx    = ctx->avctx;\n    BitstreamContext *bc     = &ctx->bc;\n    unsigned int div_blocks[32];\n    unsigned int c;\n    unsigned int js_blocks[2];\n    uint32_t bs_info = 0;\n    int ret;\n    if (sconf->ra_flag == RA_FLAG_FRAMES && ra_frame)\n        bitstream_skip(bc, 32);\n    if (sconf->mc_coding && sconf->joint_stereo) {\n        ctx->js_switch = bitstream_read_bit(bc);\n        bitstream_align(bc);\n    }\n    if (!sconf->mc_coding || ctx->js_switch) {\n        int independent_bs = !sconf->joint_stereo;\n        for (c = 0; c < avctx->channels; c++) {\n            js_blocks[0] = 0;\n            js_blocks[1] = 0;\n            get_block_sizes(ctx, div_blocks, &bs_info);\n            if (sconf->joint_stereo && sconf->block_switching)\n                if (bs_info >> 31)\n                    independent_bs = 2;\n            if (c == avctx->channels - 1)\n                independent_bs = 1;\n            if (independent_bs) {\n                ret = decode_blocks_ind(ctx, ra_frame, c,\n                                        div_blocks, js_blocks);\n                if (ret < 0)\n                    return ret;\n                independent_bs--;\n            } else {\n                ret = decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks);\n                if (ret < 0)\n                    return ret;\n                c++;\n            }\n            memmove(ctx->raw_samples[c] - sconf->max_order,\n                    ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,\n                    sizeof(*ctx->raw_samples[c]) * sconf->max_order);\n        }\n    } else {\n        ALSBlockData   bd = { 0 };\n        int            b, ret;\n        int            *reverted_channels = ctx->reverted_channels;\n        unsigned int   offset             = 0;\n        for (c = 0; c < avctx->channels; c++)\n            if (ctx->chan_data[c] < ctx->chan_data_buffer) {\n                av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data!\\n");\n                return AVERROR_INVALIDDATA;\n            }\n        memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);\n        bd.ra_block         = ra_frame;\n        bd.prev_raw_samples = ctx->prev_raw_samples;\n        get_block_sizes(ctx, div_blocks, &bs_info);\n        for (b = 0; b < ctx->num_blocks; b++) {\n            bd.block_length = div_blocks[b];\n            if (bd.block_length <= 0) {\n                av_log(ctx->avctx, AV_LOG_WARNING,\n                       "Invalid block length %u in channel data!\\n",\n                       bd.block_length);\n                continue;\n            }\n            for (c = 0; c < avctx->channels; c++) {\n                bd.const_block = ctx->const_block + c;\n                bd.shift_lsbs  = ctx->shift_lsbs + c;\n                bd.opt_order   = ctx->opt_order + c;\n                bd.store_prev_samples = ctx->store_prev_samples + c;\n                bd.use_ltp     = ctx->use_ltp + c;\n                bd.ltp_lag     = ctx->ltp_lag + c;\n                bd.ltp_gain    = ctx->ltp_gain[c];\n                bd.lpc_cof     = ctx->lpc_cof[c];\n                bd.quant_cof   = ctx->quant_cof[c];\n                bd.raw_samples = ctx->raw_samples[c] + offset;\n                bd.raw_other   = NULL;\n                if ((ret = read_block(ctx, &bd)) < 0)\n                    return ret;\n                if ((ret = read_channel_data(ctx, ctx->chan_data[c], c)) < 0)\n                    return ret;\n            }\n            for (c = 0; c < avctx->channels; c++) {\n                ret = revert_channel_correlation(ctx, &bd, ctx->chan_data,\n                                                 reverted_channels, offset, c);\n                if (ret < 0)\n                    return ret;\n            }\n            for (c = 0; c < avctx->channels; c++) {\n                bd.const_block = ctx->const_block + c;\n                bd.shift_lsbs  = ctx->shift_lsbs + c;\n                bd.opt_order   = ctx->opt_order + c;\n                bd.store_prev_samples = ctx->store_prev_samples + c;\n                bd.use_ltp     = ctx->use_ltp + c;\n                bd.ltp_lag     = ctx->ltp_lag + c;\n                bd.ltp_gain    = ctx->ltp_gain[c];\n                bd.lpc_cof     = ctx->lpc_cof[c];\n                bd.quant_cof   = ctx->quant_cof[c];\n                bd.raw_samples = ctx->raw_samples[c] + offset;\n                if ((ret = decode_block(ctx, &bd)) < 0)\n                    return ret;\n            }\n            memset(reverted_channels, 0, avctx->channels * sizeof(*reverted_channels));\n            offset      += div_blocks[b];\n            bd.ra_block  = 0;\n        }\n        for (c = 0; c < avctx->channels; c++)\n            memmove(ctx->raw_samples[c] - sconf->max_order,\n                    ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,\n                    sizeof(*ctx->raw_samples[c]) * sconf->max_order);\n    }\n    return 0;\n}', 'static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks,\n                            uint32_t *bs_info)\n{\n    ALSSpecificConfig *sconf     = &ctx->sconf;\n    BitstreamContext *bc         = &ctx->bc;\n    unsigned int *ptr_div_blocks = div_blocks;\n    unsigned int b;\n    if (sconf->block_switching) {\n        unsigned int bs_info_len = 1 << (sconf->block_switching + 2);\n        *bs_info = bitstream_read(bc, bs_info_len);\n        *bs_info <<= (32 - bs_info_len);\n    }\n    ctx->num_blocks = 0;\n    parse_bs_info(*bs_info, 0, 0, &ptr_div_blocks, &ctx->num_blocks);\n    for (b = 0; b < ctx->num_blocks; b++)\n        div_blocks[b] = ctx->sconf.frame_length >> div_blocks[b];\n    if (ctx->cur_frame_length != ctx->sconf.frame_length) {\n        unsigned int remaining = ctx->cur_frame_length;\n        for (b = 0; b < ctx->num_blocks; b++) {\n            if (remaining <= div_blocks[b]) {\n                div_blocks[b] = remaining;\n                ctx->num_blocks = b + 1;\n                break;\n            }\n            remaining -= div_blocks[b];\n        }\n    }\n}', 'static int read_block(ALSDecContext *ctx, ALSBlockData *bd)\n{\n    int ret = 0;\n    BitstreamContext *bc = &ctx->bc;\n    *bd->shift_lsbs = 0;\n    if (bitstream_read_bit(bc)) {\n        ret = read_var_block_data(ctx, bd);\n    } else {\n        read_const_block_data(ctx, bd);\n    }\n    return ret;\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}', 'static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)\n{\n    ALSSpecificConfig *sconf = &ctx->sconf;\n    AVCodecContext *avctx    = ctx->avctx;\n    BitstreamContext *bc     = &ctx->bc;\n    *bd->raw_samples = 0;\n    *bd->const_block = bitstream_read_bit(bc);\n    bd->js_blocks    = bitstream_read_bit(bc);\n    bitstream_skip(bc, 5);\n    if (*bd->const_block) {\n        unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample;\n        *bd->raw_samples = bitstream_read_signed(bc, const_val_bits);\n    }\n    *bd->const_block = 1;\n}', 'static inline void bitstream_skip(BitstreamContext *bc, unsigned n)\n{\n    if (n <= bc->bits_left)\n        skip_remaining(bc, n);\n    else {\n        n -= bc->bits_left;\n        skip_remaining(bc, bc->bits_left);\n        if (n >= 64) {\n            unsigned skip = n / 8;\n            n -= skip * 8;\n            bc->ptr += skip;\n        }\n        refill_64(bc);\n        if (n)\n            skip_remaining(bc, n);\n    }\n}', 'static inline void skip_remaining(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    bc->bits >>= n;\n#else\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n}']