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

libavcodec/tta.c:210:21: Call
208.         bitstream_skip(&s->bc, 32);
209. 
210.         s->format = bitstream_read(&s->bc, 16);
                         ^
211.         if (s->format > 2) {
212.             av_log(s->avctx, AV_LOG_ERROR, "Invalid format\n");

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] - 16):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 av_cold int tta_decode_init(AVCodecContext * avctx)\n{\n    TTAContext *s = avctx->priv_data;\n    int total_frames;\n    s->avctx = avctx;\n    if (avctx->extradata_size < 30)\n        return -1;\n    bitstream_init(&s->bc, avctx->extradata, avctx->extradata_size * 8);\n    if (bitstream_peek(&s->bc, 32) == AV_RL32("TTA1")) {\n        if (avctx->err_recognition & AV_EF_CRCCHECK) {\n            s->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);\n            tta_check_crc(s, avctx->extradata, 18);\n        }\n        bitstream_skip(&s->bc, 32);\n        s->format = bitstream_read(&s->bc, 16);\n        if (s->format > 2) {\n            av_log(s->avctx, AV_LOG_ERROR, "Invalid format\\n");\n            return -1;\n        }\n        if (s->format == FORMAT_ENCRYPTED) {\n            avpriv_report_missing_feature(s->avctx, "Encrypted TTA");\n            return AVERROR_PATCHWELCOME;\n        }\n        avctx->channels              =\n        s->channels                  = bitstream_read(&s->bc, 16);\n        avctx->bits_per_coded_sample = bitstream_read(&s->bc, 16);\n        s->bps = (avctx->bits_per_coded_sample + 7) / 8;\n        avctx->sample_rate           = bitstream_read(&s->bc, 32);\n        s->data_length               = bitstream_read(&s->bc, 32);\n        bitstream_skip(&s->bc, 32);\n        if (s->channels == 0) {\n            av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\\n");\n            return AVERROR_INVALIDDATA;\n        } else if (avctx->sample_rate == 0) {\n            av_log(s->avctx, AV_LOG_ERROR, "Invalid samplerate\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        switch(s->bps) {\n        case 2:\n            avctx->sample_fmt = AV_SAMPLE_FMT_S16;\n            avctx->bits_per_raw_sample = 16;\n            break;\n        case 3:\n            avctx->sample_fmt = AV_SAMPLE_FMT_S32;\n            avctx->bits_per_raw_sample = 24;\n            break;\n        default:\n            av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        if (avctx->sample_rate > 0x7FFFFFu) {\n            av_log(avctx, AV_LOG_ERROR, "sample_rate too large\\n");\n            return AVERROR(EINVAL);\n        }\n        s->frame_length = 256 * avctx->sample_rate / 245;\n        s->last_frame_length = s->data_length % s->frame_length;\n        total_frames = s->data_length / s->frame_length +\n                       (s->last_frame_length ? 1 : 0);\n        av_log(s->avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\\n",\n            s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,\n            avctx->block_align);\n        av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\\n",\n            s->data_length, s->frame_length, s->last_frame_length, total_frames);\n        if (avctx->extradata_size <= 26 || total_frames > INT_MAX / 4 ||\n            avctx->extradata_size - 26 < total_frames * 4)\n            av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\\n");\n        else if (avctx->err_recognition & AV_EF_CRCCHECK) {\n            int ret = tta_check_crc(s, avctx->extradata + 22, total_frames * 4);\n            if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE)\n                return AVERROR_INVALIDDATA;\n        }\n        bitstream_skip(&s->bc, 32 * total_frames);\n        bitstream_skip(&s->bc, 32);\n        if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){\n            av_log(avctx, AV_LOG_ERROR, "frame_length too large\\n");\n            return -1;\n        }\n        if (s->bps == 2) {\n            s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);\n            if (!s->decode_buffer)\n                return AVERROR(ENOMEM);\n        }\n        s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx));\n        if (!s->ch_ctx) {\n            av_freep(&s->decode_buffer);\n            return AVERROR(ENOMEM);\n        }\n    } else {\n        av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\\n");\n        return -1;\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}']