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

libavcodec/shorten.c:336:9: Call
334.     int maxnlpc = 0;
335.     /* shorten signature */
336.     if (bitstream_read(&s->bc, 32) != AV_RB32("ajkg")) {
             ^
337.         av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
338.         return AVERROR_INVALIDDATA;

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] - 32):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 read_header(ShortenContext *s)\n{\n    int i, ret;\n    int maxnlpc = 0;\n    if (bitstream_read(&s->bc, 32) != AV_RB32("ajkg")) {\n        av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic \'ajkg\'\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    s->lpcqoffset     = 0;\n    s->blocksize      = DEFAULT_BLOCK_SIZE;\n    s->nmean          = -1;\n    s->version        = bitstream_read(&s->bc, 8);\n    s->internal_ftype = get_uint(s, TYPESIZE);\n    s->channels = get_uint(s, CHANSIZE);\n    if (!s->channels) {\n        av_log(s->avctx, AV_LOG_ERROR, "No channels reported\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if (s->channels > MAX_CHANNELS) {\n        av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\\n", s->channels);\n        s->channels = 0;\n        return AVERROR_INVALIDDATA;\n    }\n    s->avctx->channels = s->channels;\n    if (s->version > 0) {\n        int skip_bytes;\n        unsigned blocksize;\n        blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));\n        if (!blocksize || blocksize > MAX_BLOCKSIZE) {\n            av_log(s->avctx, AV_LOG_ERROR,\n                   "invalid or unsupported block size: %d\\n",\n                   blocksize);\n            return AVERROR(EINVAL);\n        }\n        s->blocksize = blocksize;\n        maxnlpc  = get_uint(s, LPCQSIZE);\n        s->nmean = get_uint(s, 0);\n        skip_bytes = get_uint(s, NSKIPSIZE);\n        for (i = 0; i < skip_bytes; i++)\n            bitstream_skip(&s->bc, 8);\n    }\n    s->nwrap = FFMAX(NWRAP, maxnlpc);\n    if ((ret = allocate_buffers(s)) < 0)\n        return ret;\n    if ((ret = init_offset(s)) < 0)\n        return ret;\n    if (s->version > 1)\n        s->lpcqoffset = V2LPCQOFFSET;\n    if (get_ur_golomb_shorten(&s->bc, FNSIZE) != FN_VERBATIM) {\n        av_log(s->avctx, AV_LOG_ERROR,\n               "missing verbatim section at beginning of stream\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    s->header_size = get_ur_golomb_shorten(&s->bc, VERBATIM_CKSIZE_SIZE);\n    if (s->header_size >= OUT_BUFFER_SIZE ||\n        s->header_size < CANONICAL_HEADER_SIZE) {\n        av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\\n",\n               s->header_size);\n        return AVERROR_INVALIDDATA;\n    }\n    for (i = 0; i < s->header_size; i++)\n        s->header[i] = (char)get_ur_golomb_shorten(&s->bc, VERBATIM_BYTE_SIZE);\n    if ((ret = decode_wave_header(s->avctx, s->header, s->header_size)) < 0)\n        return ret;\n    s->cur_chan = 0;\n    s->bitshift = 0;\n    s->got_header = 1;\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}']