libavcodec/shorten.c:517: error: Integer Overflow L2
  ([0, +oo] - [0, 31]):unsigned32 by call to `get_uint`.

libavcodec/shorten.c:495:15: Call
493.         }
494. 
495.         cmd = get_ur_golomb_shorten(&s->bc, FNSIZE);
                   ^
496. 
497.         if (cmd > FN_VERBATIM) {

libavcodec/golomb.h:342:12: Call
  340. static inline unsigned int get_ur_golomb_shorten(BitstreamContext *bc, int k)
  341. {
  342.     return get_ur_golomb_jpegls(bc, k, INT_MAX, 0);
                  ^
  343. }
  344. 

libavcodec/golomb.h:275:1: Parameter `bc->bits_left`
    273.  * read unsigned golomb rice code (jpegls).
    274.  */
    275. static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,
         ^
    276.                                        int esc_len)
    277. {

libavcodec/golomb.h:281:11: Call
    279.     int log;
    280. 
    281.     buf = bitstream_peek(bc, 32);
                   ^
    282. 
    283.     log = av_log2(buf);

libavcodec/bitstream.h:215:1: Parameter `n`
      213. /* Return n bits from the buffer, but do not change the buffer state.
      214.  * n has to be in the 0-32 range. */
      215. static inline unsigned bitstream_peek(BitstreamContext *bc, unsigned n)
           ^
      216. {
      217.     if (n > bc->bits_left)

libavcodec/shorten.c:517:38: Call
515.                 break;
516.             case FN_BLOCKSIZE: {
517.                 unsigned blocksize = get_uint(s, av_log2(s->blocksize));
                                          ^
518.                 if (blocksize > s->blocksize) {
519.                     avpriv_report_missing_feature(avctx,

libavcodec/shorten.c:155:1: Parameter `s->bc.bits_left`
  153. }
  154. 
  155. static inline unsigned int get_uint(ShortenContext *s, int k)
       ^
  156. {
  157.     if (s->version != 0)

libavcodec/shorten.c:158:13: Call
  156. {
  157.     if (s->version != 0)
  158.         k = get_ur_golomb_shorten(&s->bc, ULONGSIZE);
                   ^
  159.     return get_ur_golomb_shorten(&s->bc, k);
  160. }

libavcodec/golomb.h:340:1: Parameter `bc->bits_left`
    338.  * read unsigned golomb rice code (shorten).
    339.  */
    340. static inline unsigned int get_ur_golomb_shorten(BitstreamContext *bc, int k)
         ^
    341. {
    342.     return get_ur_golomb_jpegls(bc, k, INT_MAX, 0);

libavcodec/golomb.h:342:12: Call
    340. static inline unsigned int get_ur_golomb_shorten(BitstreamContext *bc, int k)
    341. {
    342.     return get_ur_golomb_jpegls(bc, k, INT_MAX, 0);
                    ^
    343. }
    344. 

libavcodec/golomb.h:275:1: Parameter `k`
      273.  * read unsigned golomb rice code (jpegls).
      274.  */
      275. static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,
           ^
      276.                                        int esc_len)
      277. {

libavcodec/golomb.h:288:9: Call
      286.         buf >>= log - k;
      287.         buf  += (30 - log) << k;
      288.         bitstream_skip(bc, 32 + k - log);
                   ^
      289. 
      290.         return buf;

libavcodec/bitstream.h:241:1: Parameter `n`
        239. 
        240. /* Skip n bits in the buffer. */
        241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
             ^
        242. {
        243.     if (n <= bc->bits_left)

libavcodec/bitstream.h:244:9: Call
        242. {
        243.     if (n <= bc->bits_left)
        244.         skip_remaining(bc, n);
                     ^
        245.     else {
        246.         n -= bc->bits_left;

libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
          228. }
          229. 
          230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
               ^
          231. {
          232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `n`
          228. }
          229. 
          230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
               ^
          231. {
          232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - [0, 31]):unsigned32 by call to `get_uint` 
          235.     bc->bits <<= n;
          236. #endif
          237.     bc->bits_left -= n;
                   ^
          238. }
          239. 

static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    bc->bits >>= n;
#else
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
}
['static int shorten_decode_frame(AVCodecContext *avctx, void *data,\n                                int *got_frame_ptr, AVPacket *avpkt)\n{\n    AVFrame *frame     = data;\n    const uint8_t *buf = avpkt->data;\n    int buf_size       = avpkt->size;\n    ShortenContext *s  = avctx->priv_data;\n    int i, input_buf_size = 0;\n    int ret;\n    if (s->max_framesize == 0) {\n        void *tmp_ptr;\n        s->max_framesize = 1024;\n        tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,\n                                  s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE);\n        if (!tmp_ptr) {\n            av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\\n");\n            return AVERROR(ENOMEM);\n        }\n        s->bitstream = tmp_ptr;\n    }\n    if (1 && s->max_framesize) {\n        buf_size       = FFMIN(buf_size, s->max_framesize - s->bitstream_size);\n        input_buf_size = buf_size;\n        if (s->bitstream_index + s->bitstream_size + buf_size >\n            s->allocated_bitstream_size) {\n            memmove(s->bitstream, &s->bitstream[s->bitstream_index],\n                    s->bitstream_size);\n            s->bitstream_index = 0;\n        }\n        if (buf)\n            memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf,\n                   buf_size);\n        buf               = &s->bitstream[s->bitstream_index];\n        buf_size         += s->bitstream_size;\n        s->bitstream_size = buf_size;\n        if (buf_size < s->max_framesize && avpkt->data) {\n            *got_frame_ptr = 0;\n            return input_buf_size;\n        }\n    }\n    bitstream_init8(&s->bc, buf, buf_size);\n    bitstream_skip(&s->bc, s->bitindex);\n    if (!s->got_header) {\n        if ((ret = read_header(s)) < 0)\n            return ret;\n        *got_frame_ptr = 0;\n        goto finish_frame;\n    }\n    if (s->got_quit_command) {\n        *got_frame_ptr = 0;\n        return avpkt->size;\n    }\n    s->cur_chan = 0;\n    while (s->cur_chan < s->channels) {\n        unsigned cmd;\n        int len;\n        if (bitstream_bits_left(&s->bc) < 3 + FNSIZE) {\n            *got_frame_ptr = 0;\n            break;\n        }\n        cmd = get_ur_golomb_shorten(&s->bc, FNSIZE);\n        if (cmd > FN_VERBATIM) {\n            av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\\n", cmd);\n            *got_frame_ptr = 0;\n            break;\n        }\n        if (!is_audio_command[cmd]) {\n            switch (cmd) {\n            case FN_VERBATIM:\n                len = get_ur_golomb_shorten(&s->bc, VERBATIM_CKSIZE_SIZE);\n                while (len--)\n                    get_ur_golomb_shorten(&s->bc, VERBATIM_BYTE_SIZE);\n                break;\n            case FN_BITSHIFT:\n                s->bitshift = get_ur_golomb_shorten(&s->bc, BITSHIFTSIZE);\n                if (s->bitshift < 0)\n                    return AVERROR_INVALIDDATA;\n                break;\n            case FN_BLOCKSIZE: {\n                unsigned blocksize = get_uint(s, av_log2(s->blocksize));\n                if (blocksize > s->blocksize) {\n                    avpriv_report_missing_feature(avctx,\n                                                  "Increasing block size");\n                    return AVERROR_PATCHWELCOME;\n                }\n                if (!blocksize || blocksize > MAX_BLOCKSIZE) {\n                    av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "\n                                                "block size: %d\\n", blocksize);\n                    return AVERROR(EINVAL);\n                }\n                s->blocksize = blocksize;\n                break;\n            }\n            case FN_QUIT:\n                s->got_quit_command = 1;\n                break;\n            }\n            if (cmd == FN_BLOCKSIZE || cmd == FN_QUIT) {\n                *got_frame_ptr = 0;\n                break;\n            }\n        } else {\n            int residual_size = 0;\n            int channel = s->cur_chan;\n            int32_t coffset;\n            if (cmd != FN_ZERO) {\n                residual_size = get_ur_golomb_shorten(&s->bc, ENERGYSIZE);\n                if (s->version == 0)\n                    residual_size--;\n            }\n            if (s->nmean == 0)\n                coffset = s->offset[channel][0];\n            else {\n                int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;\n                for (i = 0; i < s->nmean; i++)\n                    sum += s->offset[channel][i];\n                coffset = sum / s->nmean;\n                if (s->version >= 2)\n                    coffset >>= FFMIN(1, s->bitshift);\n            }\n            if (cmd == FN_ZERO) {\n                for (i = 0; i < s->blocksize; i++)\n                    s->decoded[channel][i] = 0;\n            } else {\n                if ((ret = decode_subframe_lpc(s, cmd, channel,\n                                               residual_size, coffset)) < 0)\n                    return ret;\n            }\n            if (s->nmean > 0) {\n                int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;\n                for (i = 0; i < s->blocksize; i++)\n                    sum += s->decoded[channel][i];\n                for (i = 1; i < s->nmean; i++)\n                    s->offset[channel][i - 1] = s->offset[channel][i];\n                if (s->version < 2)\n                    s->offset[channel][s->nmean - 1] = sum / s->blocksize;\n                else\n                    s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift;\n            }\n            for (i = -s->nwrap; i < 0; i++)\n                s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];\n            fix_bitshift(s, s->decoded[channel]);\n            s->cur_chan++;\n            if (s->cur_chan == s->channels) {\n                frame->nb_samples = s->blocksize;\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                output_buffer((int16_t **)frame->extended_data, s->channels,\n                              s->blocksize, s->decoded);\n                *got_frame_ptr = 1;\n            }\n        }\n    }\n    if (s->cur_chan < s->channels)\n        *got_frame_ptr = 0;\nfinish_frame:\n    s->bitindex = bitstream_tell(&s->bc) - 8 * (bitstream_tell(&s->bc) / 8);\n    i           = bitstream_tell(&s->bc) / 8;\n    if (i > buf_size) {\n        av_log(s->avctx, AV_LOG_ERROR, "overread: %d\\n", i - buf_size);\n        s->bitstream_size  = 0;\n        s->bitstream_index = 0;\n        return AVERROR_INVALIDDATA;\n    }\n    if (s->bitstream_size) {\n        s->bitstream_index += i;\n        s->bitstream_size  -= i;\n        return input_buf_size;\n    } else\n        return i;\n}', 'static inline unsigned int get_ur_golomb_shorten(BitstreamContext *bc, int k)\n{\n    return get_ur_golomb_jpegls(bc, k, INT_MAX, 0);\n}', 'static inline int get_ur_golomb_jpegls(BitstreamContext *bc, int k, int limit,\n                                       int esc_len)\n{\n    unsigned int buf;\n    int log;\n    buf = bitstream_peek(bc, 32);\n    log = av_log2(buf);\n    if (log - k >= 1 && 32 - log < limit) {\n        buf >>= log - k;\n        buf  += (30 - log) << k;\n        bitstream_skip(bc, 32 + k - log);\n        return buf;\n    } else {\n        int i;\n        for (i = 0;\n             i < limit && bitstream_read_bit(bc) == 0 && bitstream_bits_left(bc) > 0;\n             i++);\n        if (i < limit - 1) {\n            buf = bitstream_read(bc, k);\n            return buf + (i << k);\n        } else if (i == limit - 1) {\n            buf = bitstream_read(bc, esc_len);\n            return buf + 1;\n        } else\n            return -1;\n    }\n}', 'static inline unsigned bitstream_peek(BitstreamContext *bc, unsigned n)\n{\n    if (n > bc->bits_left)\n        refill_32(bc);\n    return show_val(bc, n);\n}', 'static inline unsigned int get_uint(ShortenContext *s, int k)\n{\n    if (s->version != 0)\n        k = get_ur_golomb_shorten(&s->bc, ULONGSIZE);\n    return get_ur_golomb_shorten(&s->bc, k);\n}', 'static inline void bitstream_skip(BitstreamContext *bc, unsigned n)\n{\n    if (n <= bc->bits_left)\n        skip_remaining(bc, n);\n    else {\n        n -= bc->bits_left;\n        skip_remaining(bc, bc->bits_left);\n        if (n >= 64) {\n            unsigned skip = n / 8;\n            n -= skip * 8;\n            bc->ptr += skip;\n        }\n        refill_64(bc);\n        if (n)\n            skip_remaining(bc, n);\n    }\n}', 'static inline void skip_remaining(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    bc->bits >>= n;\n#else\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n}']