libavcodec/flacdec.c:682: error: Null Dereference
  pointer `s->bitstream` last assigned on line 678 could be null and is dereferenced at line 682, column 38.

libavcodec/flacdec.c:659:1: start of procedure flac_decode_frame()
657. }
658. 
659. static int flac_decode_frame(AVCodecContext *avctx,
     ^
660.                             void *data, int *data_size,
661.                             AVPacket *avpkt)

libavcodec/flacdec.c:663:5: 
661.                             AVPacket *avpkt)
662. {
663.     const uint8_t *buf = avpkt->data;
         ^
664.     int buf_size = avpkt->size;
665.     FLACContext *s = avctx->priv_data;

libavcodec/flacdec.c:664:5: 
662. {
663.     const uint8_t *buf = avpkt->data;
664.     int buf_size = avpkt->size;
         ^
665.     FLACContext *s = avctx->priv_data;
666.     int i, j = 0, input_buf_size = 0, bytes_read = 0;

libavcodec/flacdec.c:665:5: 
663.     const uint8_t *buf = avpkt->data;
664.     int buf_size = avpkt->size;
665.     FLACContext *s = avctx->priv_data;
         ^
666.     int i, j = 0, input_buf_size = 0, bytes_read = 0;
667.     int16_t *samples_16 = data;

libavcodec/flacdec.c:666:5: 
664.     int buf_size = avpkt->size;
665.     FLACContext *s = avctx->priv_data;
666.     int i, j = 0, input_buf_size = 0, bytes_read = 0;
         ^
667.     int16_t *samples_16 = data;
668.     int32_t *samples_32 = data;

libavcodec/flacdec.c:667:5: 
665.     FLACContext *s = avctx->priv_data;
666.     int i, j = 0, input_buf_size = 0, bytes_read = 0;
667.     int16_t *samples_16 = data;
         ^
668.     int32_t *samples_32 = data;
669.     int alloc_data_size= *data_size;

libavcodec/flacdec.c:668:5: 
666.     int i, j = 0, input_buf_size = 0, bytes_read = 0;
667.     int16_t *samples_16 = data;
668.     int32_t *samples_32 = data;
         ^
669.     int alloc_data_size= *data_size;
670.     int output_size;

libavcodec/flacdec.c:669:5: 
667.     int16_t *samples_16 = data;
668.     int32_t *samples_32 = data;
669.     int alloc_data_size= *data_size;
         ^
670.     int output_size;
671. 

libavcodec/flacdec.c:672:5: 
670.     int output_size;
671. 
672.     *data_size=0;
         ^
673. 
674.     if (s->max_framesize == 0) {

libavcodec/flacdec.c:674:9: Taking true branch
672.     *data_size=0;
673. 
674.     if (s->max_framesize == 0) {
             ^
675.         s->max_framesize =
676.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,

libavcodec/flacdec.c:676:40: Condition is true
674.     if (s->max_framesize == 0) {
675.         s->max_framesize =
676.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
                                            ^
677.                                        FLAC_MAX_CHANNELS, 32);
678.         s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);

libavcodec/flacdec.c:675:9: 
673. 
674.     if (s->max_framesize == 0) {
675.         s->max_framesize =
             ^
676.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
677.                                        FLAC_MAX_CHANNELS, 32);

libavcodec/flac.c:24:1: start of procedure ff_flac_get_max_frame_size()
  22. #include "flac.h"
  23. 
  24. int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
      ^
  25. {
  26.     /* Technically, there is no limit to FLAC frame size, but an encoder

libavcodec/flac.c:32:5: 
  30.     int count;
  31. 
  32.     count = 16;                  /* frame header */
          ^
  33.     count += ch * ((7+bps+7)/8); /* subframe headers */
  34.     if (ch == 2) {

libavcodec/flac.c:33:5: 
  31. 
  32.     count = 16;                  /* frame header */
  33.     count += ch * ((7+bps+7)/8); /* subframe headers */
          ^
  34.     if (ch == 2) {
  35.         /* for stereo, need to account for using decorrelation */

libavcodec/flac.c:34:9: Taking false branch
  32.     count = 16;                  /* frame header */
  33.     count += ch * ((7+bps+7)/8); /* subframe headers */
  34.     if (ch == 2) {
              ^
  35.         /* for stereo, need to account for using decorrelation */
  36.         count += (( 2*bps+1) * blocksize + 7) / 8;

libavcodec/flac.c:38:9: 
  36.         count += (( 2*bps+1) * blocksize + 7) / 8;
  37.     } else {
  38.         count += ( ch*bps    * blocksize + 7) / 8;
              ^
  39.     }
  40.     count += 2; /* frame footer */

libavcodec/flac.c:40:5: 
  38.         count += ( ch*bps    * blocksize + 7) / 8;
  39.     }
  40.     count += 2; /* frame footer */
          ^
  41. 
  42.     return count;

libavcodec/flac.c:42:5: 
  40.     count += 2; /* frame footer */
  41. 
  42.     return count;
          ^
  43. }

libavcodec/flac.c:43:1: return from a call to ff_flac_get_max_frame_size
  41. 
  42.     return count;
  43. }
      ^

libavcodec/flacdec.c:678:9: 
676.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
677.                                        FLAC_MAX_CHANNELS, 32);
678.         s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
             ^
679.     }
680. 

libavcodec/utils.c:48:1: start of procedure av_fast_realloc()
  46. static void *codec_mutex;
  47. 
  48. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
      ^
  49. {
  50.     if(min_size < *size)

libavcodec/utils.c:50:8: Taking false branch
  48. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
  49. {
  50.     if(min_size < *size)
             ^
  51.         return ptr;
  52. 

libavcodec/utils.c:53:12: Condition is false
  51.         return ptr;
  52. 
  53.     *size= FFMAX(17*min_size/16 + 32, min_size);
                 ^
  54. 
  55.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:53:5: 
  51.         return ptr;
  52. 
  53.     *size= FFMAX(17*min_size/16 + 32, min_size);
          ^
  54. 
  55.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:55:5: 
  53.     *size= FFMAX(17*min_size/16 + 32, min_size);
  54. 
  55.     ptr= av_realloc(ptr, *size);
          ^
  56.     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
  57.         *size= 0;

libavutil/mem.c:119:1: start of procedure av_realloc()
    117. }
    118. 
    119. void *av_realloc(void *ptr, unsigned int size)
         ^
    120. {
    121. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:126:8: Taking true branch
    124. 
    125.     /* let's disallow possible ambiguous cases */
    126.     if(size > (INT_MAX-16) )
                ^
    127.         return NULL;
    128. 

libavutil/mem.c:127:9: 
    125.     /* let's disallow possible ambiguous cases */
    126.     if(size > (INT_MAX-16) )
    127.         return NULL;
                 ^
    128. 
    129. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:137:1: return from a call to av_realloc
    135.     return realloc(ptr, size);
    136. #endif
    137. }
         ^
    138. 
    139. void av_free(void *ptr)

libavcodec/utils.c:56:9: Taking true branch
  54. 
  55.     ptr= av_realloc(ptr, *size);
  56.     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
              ^
  57.         *size= 0;
  58. 

libavcodec/utils.c:57:9: 
  55.     ptr= av_realloc(ptr, *size);
  56.     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
  57.         *size= 0;
              ^
  58. 
  59.     return ptr;

libavcodec/utils.c:59:5: 
  57.         *size= 0;
  58. 
  59.     return ptr;
          ^
  60. }
  61. 

libavcodec/utils.c:60:1: return from a call to av_fast_realloc
  58. 
  59.     return ptr;
  60. }
      ^
  61. 
  62. void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)

libavcodec/flacdec.c:681:9: Taking true branch
679.     }
680. 
681.     if (1 && s->max_framesize) { //FIXME truncated
             ^
682.         if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C'))
683.             buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize));

libavcodec/flacdec.c:681:14: Taking true branch
679.     }
680. 
681.     if (1 && s->max_framesize) { //FIXME truncated
                  ^
682.         if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C'))
683.             buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize));

libavcodec/flacdec.c:682:13: Taking false branch
680. 
681.     if (1 && s->max_framesize) { //FIXME truncated
682.         if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C'))
                 ^
683.             buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize));
684.         input_buf_size= buf_size;

libavcodec/flacdec.c:682:38: 
680. 
681.     if (1 && s->max_framesize) { //FIXME truncated
682.         if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C'))
                                          ^
683.             buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize));
684.         input_buf_size= buf_size;
