libavcodec/shorten.c:290: error: Null Dereference
  pointer `s->bitstream` last assigned on line 281 could be null and is dereferenced by call to `memmove()` at line 290, column 13.

libavcodec/shorten.c:270:1: start of procedure shorten_decode_frame()
268. 
269. 
270. static int shorten_decode_frame(AVCodecContext *avctx,
     ^
271.         void *data, int *data_size,
272.         AVPacket *avpkt)

libavcodec/shorten.c:274:5: 
272.         AVPacket *avpkt)
273. {
274.     const uint8_t *buf = avpkt->data;
         ^
275.     int buf_size = avpkt->size;
276.     ShortenContext *s = avctx->priv_data;

libavcodec/shorten.c:275:5: 
273. {
274.     const uint8_t *buf = avpkt->data;
275.     int buf_size = avpkt->size;
         ^
276.     ShortenContext *s = avctx->priv_data;
277.     int i, input_buf_size = 0;

libavcodec/shorten.c:276:5: 
274.     const uint8_t *buf = avpkt->data;
275.     int buf_size = avpkt->size;
276.     ShortenContext *s = avctx->priv_data;
         ^
277.     int i, input_buf_size = 0;
278.     int16_t *samples = data;

libavcodec/shorten.c:277:5: 
275.     int buf_size = avpkt->size;
276.     ShortenContext *s = avctx->priv_data;
277.     int i, input_buf_size = 0;
         ^
278.     int16_t *samples = data;
279.     if(s->max_framesize == 0){

libavcodec/shorten.c:278:5: 
276.     ShortenContext *s = avctx->priv_data;
277.     int i, input_buf_size = 0;
278.     int16_t *samples = data;
         ^
279.     if(s->max_framesize == 0){
280.         s->max_framesize= 1024; // should hopefully be enough for the first header

libavcodec/shorten.c:279:8: Taking true branch
277.     int i, input_buf_size = 0;
278.     int16_t *samples = data;
279.     if(s->max_framesize == 0){
            ^
280.         s->max_framesize= 1024; // should hopefully be enough for the first header
281.         s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);

libavcodec/shorten.c:280:9: 
278.     int16_t *samples = data;
279.     if(s->max_framesize == 0){
280.         s->max_framesize= 1024; // should hopefully be enough for the first header
             ^
281.         s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
282.     }

libavcodec/shorten.c:281:9: 
279.     if(s->max_framesize == 0){
280.         s->max_framesize= 1024; // should hopefully be enough for the first header
281.         s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
             ^
282.     }
283. 

libavcodec/utils.c:69:1: start of procedure av_fast_realloc()
  67. static int volatile entangled_thread_counter=0;
  68. 
  69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
      ^
  70. {
  71.     if(min_size < *size)

libavcodec/utils.c:71:8: Taking false branch
  69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
  70. {
  71.     if(min_size < *size)
             ^
  72.         return ptr;
  73. 

libavcodec/utils.c:74:12: Condition is true
  72.         return ptr;
  73. 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
                 ^
  75. 
  76.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:74:5: 
  72.         return ptr;
  73. 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
          ^
  75. 
  76.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:76:5: 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
  75. 
  76.     ptr= av_realloc(ptr, *size);
          ^
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
  78.         *size= 0;

libavutil/mem.c:102:1: start of procedure av_realloc()
    100. }
    101. 
    102. void *av_realloc(void *ptr, unsigned int size)
         ^
    103. {
    104. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:109:8: Taking false branch
    107. 
    108.     /* let's disallow possible ambiguous cases */
    109.     if(size > (INT_MAX-16) )
                ^
    110.         return NULL;
    111. 

libavutil/mem.c:118:5: 
    116.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
    117. #else
    118.     return realloc(ptr, size);
             ^
    119. #endif
    120. }

libavutil/mem.c:120:1: return from a call to av_realloc
    118.     return realloc(ptr, size);
    119. #endif
    120. }
         ^
    121. 
    122. void av_free(void *ptr)

libavcodec/utils.c:77:9: Taking true branch
  75. 
  76.     ptr= av_realloc(ptr, *size);
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
              ^
  78.         *size= 0;
  79. 

libavcodec/utils.c:78:9: 
  76.     ptr= av_realloc(ptr, *size);
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
  78.         *size= 0;
              ^
  79. 
  80.     return ptr;

libavcodec/utils.c:80:5: 
  78.         *size= 0;
  79. 
  80.     return ptr;
          ^
  81. }
  82. 

libavcodec/utils.c:81:1: return from a call to av_fast_realloc
  79. 
  80.     return ptr;
  81. }
      ^
  82. 
  83. void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)

libavcodec/shorten.c:284:8: Taking true branch
282.     }
283. 
284.     if(1 && s->max_framesize){//FIXME truncated
            ^
285.         buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
286.         input_buf_size= buf_size;

libavcodec/shorten.c:284:13: Taking true branch
282.     }
283. 
284.     if(1 && s->max_framesize){//FIXME truncated
                 ^
285.         buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
286.         input_buf_size= buf_size;

libavcodec/shorten.c:285:19: Condition is false
283. 
284.     if(1 && s->max_framesize){//FIXME truncated
285.         buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
                       ^
286.         input_buf_size= buf_size;
287. 

libavcodec/shorten.c:285:9: 
283. 
284.     if(1 && s->max_framesize){//FIXME truncated
285.         buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
             ^
286.         input_buf_size= buf_size;
287. 

libavcodec/shorten.c:286:9: 
284.     if(1 && s->max_framesize){//FIXME truncated
285.         buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
286.         input_buf_size= buf_size;
             ^
287. 
288.         if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){

libavcodec/shorten.c:288:12: Taking true branch
286.         input_buf_size= buf_size;
287. 
288.         if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
                ^
289.             //                printf("memmove\n");
290.             memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);

libavcodec/shorten.c:290:13: 
288.         if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
289.             //                printf("memmove\n");
290.             memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
                 ^
291.             s->bitstream_index=0;
292.         }

static int shorten_decode_frame(AVCodecContext *avctx,
        void *data, int *data_size,
        AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    ShortenContext *s = avctx->priv_data;
    int i, input_buf_size = 0;
    int16_t *samples = data;
    if(s->max_framesize == 0){
        s->max_framesize= 1024;
        s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
    }
    if(1 && s->max_framesize){
        buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
        input_buf_size= buf_size;
        if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
            memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
            s->bitstream_index=0;
        }
        memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);
        buf= &s->bitstream[s->bitstream_index];
        buf_size += s->bitstream_size;
        s->bitstream_size= buf_size;
        if(buf_size < s->max_framesize){
            *data_size = 0;
            return input_buf_size;
        }
    }
    init_get_bits(&s->gb, buf, buf_size*8);
    skip_bits(&s->gb, s->bitindex);
    if (!s->blocksize)
    {
        int maxnlpc = 0;
        if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) {
            av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
            return -1;
        }
        s->lpcqoffset = 0;
        s->blocksize = DEFAULT_BLOCK_SIZE;
        s->channels = 1;
        s->nmean = -1;
        s->version = get_bits(&s->gb, 8);
        s->internal_ftype = get_uint(s, TYPESIZE);
        s->channels = get_uint(s, CHANSIZE);
        if (s->channels > MAX_CHANNELS) {
            av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
            return -1;
        }
        if (s->version > 0) {
            int skip_bytes;
            s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
            maxnlpc = get_uint(s, LPCQSIZE);
            s->nmean = get_uint(s, 0);
            skip_bytes = get_uint(s, NSKIPSIZE);
            for (i=0; i<skip_bytes; i++) {
                skip_bits(&s->gb, 8);
            }
        }
        s->nwrap = FFMAX(NWRAP, maxnlpc);
        if (allocate_buffers(s))
            return -1;
        init_offset(s);
        if (s->version > 1)
            s->lpcqoffset = V2LPCQOFFSET;
        if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {
            av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");
            return -1;
        }
        s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
        if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {
            av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);
            return -1;
        }
        for (i=0; i<s->header_size; i++)
            s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
        if (decode_wave_header(avctx, s->header, s->header_size) < 0)
            return -1;
        s->cur_chan = 0;
        s->bitshift = 0;
    }
    else
    {
        int cmd;
        int len;
        cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);
        switch (cmd) {
            case FN_ZERO:
            case FN_DIFF0:
            case FN_DIFF1:
            case FN_DIFF2:
            case FN_DIFF3:
            case FN_QLPC:
                {
                    int residual_size = 0;
                    int channel = s->cur_chan;
                    int32_t coffset;
                    if (cmd != FN_ZERO) {
                        residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
                        if (s->version == 0)
                            residual_size--;
                    }
                    if (s->nmean == 0)
                        coffset = s->offset[channel][0];
                    else {
                        int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
                        for (i=0; i<s->nmean; i++)
                            sum += s->offset[channel][i];
                        coffset = sum / s->nmean;
                        if (s->version >= 2)
                            coffset >>= FFMIN(1, s->bitshift);
                    }
                    switch (cmd) {
                        case FN_ZERO:
                            for (i=0; i<s->blocksize; i++)
                                s->decoded[channel][i] = 0;
                            break;
                        case FN_DIFF0:
                            for (i=0; i<s->blocksize; i++)
                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + coffset;
                            break;
                        case FN_DIFF1:
                            for (i=0; i<s->blocksize; i++)
                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + s->decoded[channel][i - 1];
                            break;
                        case FN_DIFF2:
                            for (i=0; i<s->blocksize; i++)
                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 2*s->decoded[channel][i-1]
                                                                                                      -   s->decoded[channel][i-2];
                            break;
                        case FN_DIFF3:
                            for (i=0; i<s->blocksize; i++)
                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 3*s->decoded[channel][i-1]
                                                                                                      - 3*s->decoded[channel][i-2]
                                                                                                      +   s->decoded[channel][i-3];
                            break;
                        case FN_QLPC:
                            {
                                int pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
                                for (i=0; i<pred_order; i++)
                                    s->decoded[channel][i - pred_order] -= coffset;
                                decode_subframe_lpc(s, channel, residual_size, pred_order);
                                if (coffset != 0)
                                    for (i=0; i < s->blocksize; i++)
                                        s->decoded[channel][i] += coffset;
                            }
                    }
                    if (s->nmean > 0) {
                        int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
                        for (i=0; i<s->blocksize; i++)
                            sum += s->decoded[channel][i];
                        for (i=1; i<s->nmean; i++)
                            s->offset[channel][i-1] = s->offset[channel][i];
                        if (s->version < 2)
                            s->offset[channel][s->nmean - 1] = sum / s->blocksize;
                        else
                            s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift;
                    }
                    for (i=-s->nwrap; i<0; i++)
                        s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
                    fix_bitshift(s, s->decoded[channel]);
                    s->cur_chan++;
                    if (s->cur_chan == s->channels) {
                        samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
                        s->cur_chan = 0;
                        goto frame_done;
                    }
                    break;
                }
                break;
            case FN_VERBATIM:
                len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
                while (len--) {
                    get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
                }
                break;
            case FN_BITSHIFT:
                s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
                break;
            case FN_BLOCKSIZE:
                s->blocksize = get_uint(s, av_log2(s->blocksize));
                break;
            case FN_QUIT:
                *data_size = 0;
                return buf_size;
                break;
            default:
                av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
                return -1;
                break;
        }
    }
frame_done:
    *data_size = (int8_t *)samples - (int8_t *)data;
    s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
    i= (get_bits_count(&s->gb))/8;
    if (i > buf_size) {
        av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size);
        s->bitstream_size=0;
        s->bitstream_index=0;
        return -1;
    }
    if (s->bitstream_size) {
        s->bitstream_index += i;
        s->bitstream_size  -= i;
        return input_buf_size;
    } else
        return i;
}
['static int shorten_decode_frame(AVCodecContext *avctx,\n        void *data, int *data_size,\n        AVPacket *avpkt)\n{\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    int16_t *samples = data;\n    if(s->max_framesize == 0){\n        s->max_framesize= 1024;\n        s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);\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 > s->allocated_bitstream_size){\n            memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);\n            s->bitstream_index=0;\n        }\n        memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, 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){\n            *data_size = 0;\n            return input_buf_size;\n        }\n    }\n    init_get_bits(&s->gb, buf, buf_size*8);\n    skip_bits(&s->gb, s->bitindex);\n    if (!s->blocksize)\n    {\n        int maxnlpc = 0;\n        if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) {\n            av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic \'ajkg\'\\n");\n            return -1;\n        }\n        s->lpcqoffset = 0;\n        s->blocksize = DEFAULT_BLOCK_SIZE;\n        s->channels = 1;\n        s->nmean = -1;\n        s->version = get_bits(&s->gb, 8);\n        s->internal_ftype = get_uint(s, TYPESIZE);\n        s->channels = get_uint(s, CHANSIZE);\n        if (s->channels > MAX_CHANNELS) {\n            av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\\n", s->channels);\n            return -1;\n        }\n        if (s->version > 0) {\n            int skip_bytes;\n            s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));\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                skip_bits(&s->gb, 8);\n            }\n        }\n        s->nwrap = FFMAX(NWRAP, maxnlpc);\n        if (allocate_buffers(s))\n            return -1;\n        init_offset(s);\n        if (s->version > 1)\n            s->lpcqoffset = V2LPCQOFFSET;\n        if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {\n            av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\\n");\n            return -1;\n        }\n        s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);\n        if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {\n            av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\\n", s->header_size);\n            return -1;\n        }\n        for (i=0; i<s->header_size; i++)\n            s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);\n        if (decode_wave_header(avctx, s->header, s->header_size) < 0)\n            return -1;\n        s->cur_chan = 0;\n        s->bitshift = 0;\n    }\n    else\n    {\n        int cmd;\n        int len;\n        cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);\n        switch (cmd) {\n            case FN_ZERO:\n            case FN_DIFF0:\n            case FN_DIFF1:\n            case FN_DIFF2:\n            case FN_DIFF3:\n            case FN_QLPC:\n                {\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->gb, 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                    switch (cmd) {\n                        case FN_ZERO:\n                            for (i=0; i<s->blocksize; i++)\n                                s->decoded[channel][i] = 0;\n                            break;\n                        case FN_DIFF0:\n                            for (i=0; i<s->blocksize; i++)\n                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + coffset;\n                            break;\n                        case FN_DIFF1:\n                            for (i=0; i<s->blocksize; i++)\n                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + s->decoded[channel][i - 1];\n                            break;\n                        case FN_DIFF2:\n                            for (i=0; i<s->blocksize; i++)\n                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 2*s->decoded[channel][i-1]\n                                                                                                      -   s->decoded[channel][i-2];\n                            break;\n                        case FN_DIFF3:\n                            for (i=0; i<s->blocksize; i++)\n                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 3*s->decoded[channel][i-1]\n                                                                                                      - 3*s->decoded[channel][i-2]\n                                                                                                      +   s->decoded[channel][i-3];\n                            break;\n                        case FN_QLPC:\n                            {\n                                int pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);\n                                for (i=0; i<pred_order; i++)\n                                    s->decoded[channel][i - pred_order] -= coffset;\n                                decode_subframe_lpc(s, channel, residual_size, pred_order);\n                                if (coffset != 0)\n                                    for (i=0; i < s->blocksize; i++)\n                                        s->decoded[channel][i] += coffset;\n                            }\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                        samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);\n                        s->cur_chan = 0;\n                        goto frame_done;\n                    }\n                    break;\n                }\n                break;\n            case FN_VERBATIM:\n                len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);\n                while (len--) {\n                    get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);\n                }\n                break;\n            case FN_BITSHIFT:\n                s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);\n                break;\n            case FN_BLOCKSIZE:\n                s->blocksize = get_uint(s, av_log2(s->blocksize));\n                break;\n            case FN_QUIT:\n                *data_size = 0;\n                return buf_size;\n                break;\n            default:\n                av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\\n", cmd);\n                return -1;\n                break;\n        }\n    }\nframe_done:\n    *data_size = (int8_t *)samples - (int8_t *)data;\n    s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);\n    i= (get_bits_count(&s->gb))/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 -1;\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}', 'void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)\n{\n    if(min_size < *size)\n        return ptr;\n    *size= FFMAX(17*min_size/16 + 32, min_size);\n    ptr= av_realloc(ptr, *size);\n    if(!ptr)\n        *size= 0;\n    return ptr;\n}', 'void *av_realloc(void *ptr, unsigned int size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if(!ptr) return av_malloc(size);\n    diff= ((char*)ptr)[-1];\n    return (char*)realloc((char*)ptr - diff, size + diff) + diff;\n#else\n    return realloc(ptr, size);\n#endif\n}']