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

libavcodec/alac.c:331:36: Call
329.             /* read the predictor table */
330.             for (i = lpc_order[ch] - 1; i >= 0; i--)
331.                 lpc_coefs[ch][i] = bitstream_read_signed(&alac->bc, 16);
                                        ^
332.         }
333. 

libavcodec/bitstream.h:199:1: Parameter `n`
  197. /* Return n bits from the buffer as a signed integer.
  198.  * n has to be in the 0-32 range. */
  199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n)
       ^
  200. {
  201.     return sign_extend(bitstream_read(bc, n), n);

libavcodec/bitstream.h:201:24: Call
  199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n)
  200. {
  201.     return sign_extend(bitstream_read(bc, n), n);
                              ^
  202. }
  203. 

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_signed` 
      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_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,\n                          int channels)\n{\n    ALACContext *alac = avctx->priv_data;\n    int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;\n    uint32_t output_samples;\n    int i, ch;\n    bitstream_skip(&alac->bc, 4);\n    bitstream_skip(&alac->bc, 12);\n    has_size = bitstream_read_bit(&alac->bc);\n    alac->extra_bits = bitstream_read(&alac->bc, 2) << 3;\n    bps = alac->sample_size - alac->extra_bits + channels - 1;\n    if (bps > 32) {\n        avpriv_report_missing_feature(avctx, "bps %d", bps);\n        return AVERROR_PATCHWELCOME;\n    }\n    is_compressed = !bitstream_read_bit(&alac->bc);\n    if (has_size)\n        output_samples = bitstream_read(&alac->bc, 32);\n    else\n        output_samples = alac->max_samples_per_frame;\n    if (!output_samples || output_samples > alac->max_samples_per_frame) {\n        av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %"PRIu32"\\n",\n               output_samples);\n        return AVERROR_INVALIDDATA;\n    }\n    if (!alac->nb_samples) {\n        frame->nb_samples = output_samples;\n        if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {\n            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n            return ret;\n        }\n    } else if (output_samples != alac->nb_samples) {\n        av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %"PRIu32" != %d\\n",\n               output_samples, alac->nb_samples);\n        return AVERROR_INVALIDDATA;\n    }\n    alac->nb_samples = output_samples;\n    if (alac->sample_size > 16) {\n        for (ch = 0; ch < channels; ch++)\n            alac->output_samples_buffer[ch] = (int32_t *)frame->extended_data[ch_index + ch];\n    }\n    if (is_compressed) {\n        int16_t lpc_coefs[2][32];\n        int lpc_order[2];\n        int prediction_type[2];\n        int lpc_quant[2];\n        int rice_history_mult[2];\n        if (!alac->rice_limit) {\n            avpriv_request_sample(alac->avctx,\n                                  "Compression with rice limit 0");\n            return AVERROR(ENOSYS);\n        }\n        decorr_shift       = bitstream_read(&alac->bc, 8);\n        decorr_left_weight = bitstream_read(&alac->bc, 8);\n        for (ch = 0; ch < channels; ch++) {\n            prediction_type[ch]   = bitstream_read(&alac->bc, 4);\n            lpc_quant[ch]         = bitstream_read(&alac->bc, 4);\n            rice_history_mult[ch] = bitstream_read(&alac->bc, 3);\n            lpc_order[ch]         = bitstream_read(&alac->bc, 5);\n            if (lpc_order[ch] >= alac->max_samples_per_frame)\n                return AVERROR_INVALIDDATA;\n            for (i = lpc_order[ch] - 1; i >= 0; i--)\n                lpc_coefs[ch][i] = bitstream_read_signed(&alac->bc, 16);\n        }\n        if (alac->extra_bits) {\n            for (i = 0; i < alac->nb_samples; i++) {\n                for (ch = 0; ch < channels; ch++)\n                    alac->extra_bits_buffer[ch][i] = bitstream_read(&alac->bc, alac->extra_bits);\n            }\n        }\n        for (ch = 0; ch < channels; ch++) {\n            rice_decompress(alac, alac->predict_error_buffer[ch],\n                            alac->nb_samples, bps,\n                            rice_history_mult[ch] * alac->rice_history_mult / 4);\n            if (prediction_type[ch] == 15) {\n                lpc_prediction(alac->predict_error_buffer[ch],\n                               alac->predict_error_buffer[ch],\n                               alac->nb_samples, bps, NULL, 31, 0);\n            } else if (prediction_type[ch] > 0) {\n                av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\\n",\n                       prediction_type[ch]);\n            }\n            lpc_prediction(alac->predict_error_buffer[ch],\n                           alac->output_samples_buffer[ch], alac->nb_samples,\n                           bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);\n        }\n    } else {\n        for (i = 0; i < alac->nb_samples; i++) {\n            for (ch = 0; ch < channels; ch++) {\n                alac->output_samples_buffer[ch][i] =\n                         bitstream_read_signed(&alac->bc, alac->sample_size);\n            }\n        }\n        alac->extra_bits   = 0;\n        decorr_shift       = 0;\n        decorr_left_weight = 0;\n    }\n    if (channels == 2 && decorr_left_weight) {\n        decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,\n                           decorr_shift, decorr_left_weight);\n    }\n    if (alac->extra_bits) {\n        append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,\n                          alac->extra_bits, channels, alac->nb_samples);\n    }\n    switch(alac->sample_size) {\n    case 16: {\n        for (ch = 0; ch < channels; ch++) {\n            int16_t *outbuffer = (int16_t *)frame->extended_data[ch_index + ch];\n            for (i = 0; i < alac->nb_samples; i++)\n                *outbuffer++ = alac->output_samples_buffer[ch][i];\n        }}\n        break;\n    case 24: {\n        for (ch = 0; ch < channels; ch++) {\n            for (i = 0; i < alac->nb_samples; i++)\n                alac->output_samples_buffer[ch][i] <<= 8;\n        }}\n        break;\n    }\n    return 0;\n}', 'static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n)\n{\n    return sign_extend(bitstream_read(bc, n), n);\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}']