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

libavcodec/atrac3.c:688:45: Call
686.             q->matrix_coeff_index_prev[i] = q->matrix_coeff_index_now[i];
687.             q->matrix_coeff_index_now[i]  = q->matrix_coeff_index_next[i];
688.             q->matrix_coeff_index_next[i] = bitstream_read(&q->bc, 2);
                                                 ^
689.         }
690. 

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] - 2):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 decode_frame(AVCodecContext *avctx, const uint8_t *databuf,\n                        float **out_samples)\n{\n    ATRAC3Context *q = avctx->priv_data;\n    int ret, i;\n    uint8_t *ptr1;\n    if (q->coding_mode == JOINT_STEREO) {\n        bitstream_init(&q->bc, databuf, avctx->block_align * 8);\n        ret = decode_channel_sound_unit(q, &q->bc, q->units, out_samples[0], 0,\n                                        JOINT_STEREO);\n        if (ret != 0)\n            return ret;\n        if (databuf == q->decoded_bytes_buffer) {\n            uint8_t *ptr2 = q->decoded_bytes_buffer + avctx->block_align - 1;\n            ptr1          = q->decoded_bytes_buffer;\n            for (i = 0; i < avctx->block_align / 2; i++, ptr1++, ptr2--)\n                FFSWAP(uint8_t, *ptr1, *ptr2);\n        } else {\n            const uint8_t *ptr2 = databuf + avctx->block_align - 1;\n            for (i = 0; i < avctx->block_align; i++)\n                q->decoded_bytes_buffer[i] = *ptr2--;\n        }\n        ptr1 = q->decoded_bytes_buffer;\n        for (i = 4; *ptr1 == 0xF8; i++, ptr1++) {\n            if (i >= avctx->block_align)\n                return AVERROR_INVALIDDATA;\n        }\n        bitstream_init(&q->bc, ptr1, (avctx->block_align - i) * 8);\n        memmove(q->weighting_delay, &q->weighting_delay[2],\n                4 * sizeof(*q->weighting_delay));\n        q->weighting_delay[4] = bitstream_read_bit(&q->bc);\n        q->weighting_delay[5] = bitstream_read(&q->bc, 3);\n        for (i = 0; i < 4; i++) {\n            q->matrix_coeff_index_prev[i] = q->matrix_coeff_index_now[i];\n            q->matrix_coeff_index_now[i]  = q->matrix_coeff_index_next[i];\n            q->matrix_coeff_index_next[i] = bitstream_read(&q->bc, 2);\n        }\n        ret = decode_channel_sound_unit(q, &q->bc, &q->units[1],\n                                        out_samples[1], 1, JOINT_STEREO);\n        if (ret != 0)\n            return ret;\n        reverse_matrixing(out_samples[0], out_samples[1],\n                          q->matrix_coeff_index_prev,\n                          q->matrix_coeff_index_now);\n        channel_weighting(out_samples[0], out_samples[1], q->weighting_delay);\n    } else {\n        for (i = 0; i < avctx->channels; i++) {\n            bitstream_init(&q->bc,\n                           databuf + i * avctx->block_align / avctx->channels,\n                           avctx->block_align * 8 / avctx->channels);\n            ret = decode_channel_sound_unit(q, &q->bc, &q->units[i],\n                                            out_samples[i], i, q->coding_mode);\n            if (ret != 0)\n                return ret;\n        }\n    }\n    for (i = 0; i < avctx->channels; i++) {\n        float *p1 = out_samples[i];\n        float *p2 = p1 + 256;\n        float *p3 = p2 + 256;\n        float *p4 = p3 + 256;\n        ff_atrac_iqmf(p1, p2, 256, p1, q->units[i].delay_buf1, q->temp_buf);\n        ff_atrac_iqmf(p4, p3, 256, p3, q->units[i].delay_buf2, q->temp_buf);\n        ff_atrac_iqmf(p1, p3, 512, p1, q->units[i].delay_buf3, q->temp_buf);\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 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}']