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

libavcodec/alac.c:136:26: Call
134.             k = 7 - av_log2(history) + ((history + 16) >> 6);
135.             k = FFMIN(k, alac->rice_limit);
136.             block_size = decode_scalar(&alac->bc, k, 16);
                              ^
137. 
138.             if (block_size > 0) {

libavcodec/alac.c:81:1: Parameter `bps`
  79. } ALACContext;
  80. 
  81. static inline unsigned int decode_scalar(BitstreamContext *bc, int k, int bps)
      ^
  82. {
  83.     unsigned int x = get_unary_0_9(bc);

libavcodec/alac.c:87:13: Call
  85.     if (x > 8) { /* RICE THRESHOLD */
  86.         /* use alternative encoding */
  87.         x = bitstream_read(bc, bps);
                  ^
  88.     } else if (k != 1) {
  89.         int extrabits = bitstream_peek(bc, k);

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 `decode_scalar` 
      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 void rice_decompress(ALACContext *alac, int32_t *output_buffer,\n                            int nb_samples, int bps, int rice_history_mult)\n{\n    int i;\n    unsigned int history = alac->rice_initial_history;\n    int sign_modifier = 0;\n    for (i = 0; i < nb_samples; i++) {\n        int k;\n        unsigned int x;\n        k = av_log2((history >> 9) + 3);\n        k = FFMIN(k, alac->rice_limit);\n        x = decode_scalar(&alac->bc, k, bps);\n        x += sign_modifier;\n        sign_modifier = 0;\n        output_buffer[i] = (x >> 1) ^ -(x & 1);\n        if (x > 0xffff)\n            history = 0xffff;\n        else\n            history +=         x * rice_history_mult -\n                       ((history * rice_history_mult) >> 9);\n        if ((history < 128) && (i + 1 < nb_samples)) {\n            int block_size;\n            k = 7 - av_log2(history) + ((history + 16) >> 6);\n            k = FFMIN(k, alac->rice_limit);\n            block_size = decode_scalar(&alac->bc, k, 16);\n            if (block_size > 0) {\n                if (block_size >= nb_samples - i) {\n                    av_log(alac->avctx, AV_LOG_ERROR,\n                           "invalid zero block size of %d %d %d\\n", block_size,\n                           nb_samples, i);\n                    block_size = nb_samples - i - 1;\n                }\n                memset(&output_buffer[i + 1], 0,\n                       block_size * sizeof(*output_buffer));\n                i += block_size;\n            }\n            if (block_size <= 0xffff)\n                sign_modifier = 1;\n            history = 0;\n        }\n    }\n}', 'static inline unsigned int decode_scalar(BitstreamContext *bc, int k, int bps)\n{\n    unsigned int x = get_unary_0_9(bc);\n    if (x > 8) {\n        x = bitstream_read(bc, bps);\n    } else if (k != 1) {\n        int extrabits = bitstream_peek(bc, k);\n        x = (x << k) - x;\n        if (extrabits > 1) {\n            x += extrabits - 1;\n            bitstream_skip(bc, k);\n        } else\n            bitstream_skip(bc, k - 1);\n    }\n    return x;\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}']