libavcodec/flacdec.c:519: error: Null Dereference
  pointer `s->gb.buffer` last assigned on line 518 could be null and is dereferenced by call to `decode_frame()` at line 519, column 9.

libavcodec/flacdec.c:484:1: start of procedure flac_decode_frame()
482. }
483. 
484. static int flac_decode_frame(AVCodecContext *avctx, void *data,
     ^
485.                              int *got_frame_ptr, AVPacket *avpkt)
486. {

libavcodec/flacdec.c:487:5: 
485.                              int *got_frame_ptr, AVPacket *avpkt)
486. {
487.     AVFrame *frame     = data;
         ^
488.     const uint8_t *buf = avpkt->data;
489.     int buf_size = avpkt->size;

libavcodec/flacdec.c:488:5: 
486. {
487.     AVFrame *frame     = data;
488.     const uint8_t *buf = avpkt->data;
         ^
489.     int buf_size = avpkt->size;
490.     FLACContext *s = avctx->priv_data;

libavcodec/flacdec.c:489:5: 
487.     AVFrame *frame     = data;
488.     const uint8_t *buf = avpkt->data;
489.     int buf_size = avpkt->size;
         ^
490.     FLACContext *s = avctx->priv_data;
491.     int bytes_read = 0;

libavcodec/flacdec.c:490:5: 
488.     const uint8_t *buf = avpkt->data;
489.     int buf_size = avpkt->size;
490.     FLACContext *s = avctx->priv_data;
         ^
491.     int bytes_read = 0;
492.     int ret;

libavcodec/flacdec.c:491:5: 
489.     int buf_size = avpkt->size;
490.     FLACContext *s = avctx->priv_data;
491.     int bytes_read = 0;
         ^
492.     int ret;
493. 

libavcodec/flacdec.c:494:5: 
492.     int ret;
493. 
494.     *got_frame_ptr = 0;
         ^
495. 
496.     if (s->max_framesize == 0) {

libavcodec/flacdec.c:496:9: Taking true branch
494.     *got_frame_ptr = 0;
495. 
496.     if (s->max_framesize == 0) {
             ^
497.         s->max_framesize =
498.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,

libavcodec/flacdec.c:498:40: Condition is true
496.     if (s->max_framesize == 0) {
497.         s->max_framesize =
498.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
                                            ^
499.                                        FLAC_MAX_CHANNELS, 32);
500.     }

libavcodec/flacdec.c:497:9: 
495. 
496.     if (s->max_framesize == 0) {
497.         s->max_framesize =
             ^
498.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
499.                                        FLAC_MAX_CHANNELS, 32);

libavcodec/flac.c:148:1: start of procedure ff_flac_get_max_frame_size()
  146. }
  147. 
  148. int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
       ^
  149. {
  150.     /* Technically, there is no limit to FLAC frame size, but an encoder

libavcodec/flac.c:156:5: 
  154.     int count;
  155. 
  156.     count = 16;                  /* frame header */
           ^
  157.     count += ch * ((7+bps+7)/8); /* subframe headers */
  158.     if (ch == 2) {

libavcodec/flac.c:157:5: 
  155. 
  156.     count = 16;                  /* frame header */
  157.     count += ch * ((7+bps+7)/8); /* subframe headers */
           ^
  158.     if (ch == 2) {
  159.         /* for stereo, need to account for using decorrelation */

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

libavcodec/flac.c:162:9: 
  160.         count += (( 2*bps+1) * blocksize + 7) / 8;
  161.     } else {
  162.         count += ( ch*bps    * blocksize + 7) / 8;
               ^
  163.     }
  164.     count += 2; /* frame footer */

libavcodec/flac.c:164:5: 
  162.         count += ( ch*bps    * blocksize + 7) / 8;
  163.     }
  164.     count += 2; /* frame footer */
           ^
  165. 
  166.     return count;

libavcodec/flac.c:166:5: 
  164.     count += 2; /* frame footer */
  165. 
  166.     return count;
           ^
  167. }
  168. 

libavcodec/flac.c:167:1: return from a call to ff_flac_get_max_frame_size
  165. 
  166.     return count;
  167. }
       ^
  168. 
  169. int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,

libavcodec/flacdec.c:505:9: Taking false branch
503.        this amount corresponds to the smallest valid FLAC frame possible.
504.        FF F8 69 02 00 00 9A 00 00 34 46 */
505.     if (buf_size < FLAC_MIN_FRAME_SIZE)
             ^
506.         return buf_size;
507. 

libavcodec/flacdec.c:509:9: 
507. 
508.     /* check for inline header */
509.     if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
             ^
510.         if (!s->got_streaminfo && parse_streaminfo(s, buf, buf_size)) {
511.             av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");

libavutil/ppc/intreadwrite.h:44:1: start of procedure AV_RL32()
  42. 
  43. #define AV_RL32 AV_RL32
  44. static av_always_inline uint32_t AV_RL32(const void *p)
      ^
  45. {
  46.     uint32_t v;

libavutil/ppc/intreadwrite.h:47:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
  45. {
  46.     uint32_t v;
  47.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
          ^
  48.     return v;
  49. }

libavutil/ppc/intreadwrite.h:48:5: 
  46.     uint32_t v;
  47.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
  48.     return v;
          ^
  49. }
  50. 

libavutil/ppc/intreadwrite.h:49:1: return from a call to AV_RL32
  47.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
  48.     return v;
  49. }
      ^
  50. 
  51. #define AV_WL32 AV_WL32

libavutil/bswap.h:66:1: start of procedure av_bswap32()
  64. 
  65. #ifndef av_bswap32
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      ^
  67. {
  68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
  67. {
  68.     return AV_BSWAP32C(x);
          ^
  69. }
  70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
  67. {
  68.     return AV_BSWAP32C(x);
  69. }
      ^
  70. #endif
  71. 

libavcodec/flacdec.c:509:9: Taking false branch
507. 
508.     /* check for inline header */
509.     if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
             ^
510.         if (!s->got_streaminfo && parse_streaminfo(s, buf, buf_size)) {
511.             av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");

libavcodec/flacdec.c:518:5: 
516. 
517.     /* decode frame */
518.     init_get_bits(&s->gb, buf, buf_size*8);
         ^
519.     if (decode_frame(s) < 0) {
520.         av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");

libavcodec/get_bits.h:375:1: start of procedure init_get_bits()
  373.  * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
  374.  */
  375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
       ^
  376.                                 int bit_size)
  377. {

libavcodec/get_bits.h:379:5: 
  377. {
  378.     int buffer_size;
  379.     int ret = 0;
           ^
  380. 
  381.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {

libavcodec/get_bits.h:381:9: Taking true branch
  379.     int ret = 0;
  380. 
  381.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
               ^
  382.         buffer_size = bit_size = 0;
  383.         buffer      = NULL;

libavcodec/get_bits.h:382:9: 
  380. 
  381.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  382.         buffer_size = bit_size = 0;
               ^
  383.         buffer      = NULL;
  384.         ret         = AVERROR_INVALIDDATA;

libavcodec/get_bits.h:383:9: 
  381.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  382.         buffer_size = bit_size = 0;
  383.         buffer      = NULL;
               ^
  384.         ret         = AVERROR_INVALIDDATA;
  385.     }

libavcodec/get_bits.h:384:9: 
  382.         buffer_size = bit_size = 0;
  383.         buffer      = NULL;
  384.         ret         = AVERROR_INVALIDDATA;
               ^
  385.     }
  386. 

libavcodec/get_bits.h:387:5: 
  385.     }
  386. 
  387.     buffer_size = (bit_size + 7) >> 3;
           ^
  388. 
  389.     s->buffer             = buffer;

libavcodec/get_bits.h:389:5: 
  387.     buffer_size = (bit_size + 7) >> 3;
  388. 
  389.     s->buffer             = buffer;
           ^
  390.     s->size_in_bits       = bit_size;
  391. #if !UNCHECKED_BITSTREAM_READER

libavcodec/get_bits.h:390:5: 
  388. 
  389.     s->buffer             = buffer;
  390.     s->size_in_bits       = bit_size;
           ^
  391. #if !UNCHECKED_BITSTREAM_READER
  392.     s->size_in_bits_plus8 = bit_size + 8;

libavcodec/get_bits.h:392:5: 
  390.     s->size_in_bits       = bit_size;
  391. #if !UNCHECKED_BITSTREAM_READER
  392.     s->size_in_bits_plus8 = bit_size + 8;
           ^
  393. #endif
  394.     s->buffer_end         = buffer + buffer_size;

libavcodec/get_bits.h:394:5: 
  392.     s->size_in_bits_plus8 = bit_size + 8;
  393. #endif
  394.     s->buffer_end         = buffer + buffer_size;
           ^
  395.     s->index              = 0;
  396. 

libavcodec/get_bits.h:395:5: 
  393. #endif
  394.     s->buffer_end         = buffer + buffer_size;
  395.     s->index              = 0;
           ^
  396. 
  397.     return ret;

libavcodec/get_bits.h:397:5: 
  395.     s->index              = 0;
  396. 
  397.     return ret;
           ^
  398. }
  399. 

libavcodec/get_bits.h:398:1: return from a call to init_get_bits
  396. 
  397.     return ret;
  398. }
       ^
  399. 
  400. /**

libavcodec/flacdec.c:519:9: 
517.     /* decode frame */
518.     init_get_bits(&s->gb, buf, buf_size*8);
519.     if (decode_frame(s) < 0) {
             ^
520.         av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");
521.         return -1;

libavcodec/flacdec.c:401:1: start of procedure decode_frame()
  399. }
  400. 
  401. static int decode_frame(FLACContext *s)
       ^
  402. {
  403.     int i, ret;

libavcodec/flacdec.c:404:5: 
  402. {
  403.     int i, ret;
  404.     GetBitContext *gb = &s->gb;
           ^
  405.     FLACFrameInfo fi;
  406. 

libavcodec/flacdec.c:407:9: 
  405.     FLACFrameInfo fi;
  406. 
  407.     if (ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) {
               ^
  408.         av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n");
  409.         return -1;

libavcodec/flac.c:50:1: start of procedure ff_flac_decode_frame_header()
    48. }
    49. 
    50. int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
        ^
    51.                                 FLACFrameInfo *fi, int log_level_offset)
    52. {

libavcodec/flac.c:56:9: Taking false branch
    54. 
    55.     /* frame sync code */
    56.     if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
                ^
    57.         av_log(avctx, AV_LOG_ERROR + log_level_offset, "invalid sync code\n");
    58.         return -1;

libavcodec/flac.c:62:5: 
    60. 
    61.     /* variable block size stream code */
    62.     fi->is_var_size = get_bits1(gb);
            ^
    63. 
    64.     /* block size and sample rate codes */

libavcodec/get_bits.h:271:1: start of procedure get_bits1()
      269. }
      270. 
      271. static inline unsigned int get_bits1(GetBitContext *s)
           ^
      272. {
      273.     unsigned int index = s->index;

libavcodec/get_bits.h:273:5: 
      271. static inline unsigned int get_bits1(GetBitContext *s)
      272. {
      273.     unsigned int index = s->index;
               ^
      274.     uint8_t result     = s->buffer[index >> 3];
      275. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:274:5: 
      272. {
      273.     unsigned int index = s->index;
      274.     uint8_t result     = s->buffer[index >> 3];
               ^
      275. #ifdef BITSTREAM_READER_LE
      276.     result >>= index & 7;

libavcodec/get_bits.h:276:5: 
      274.     uint8_t result     = s->buffer[index >> 3];
      275. #ifdef BITSTREAM_READER_LE
      276.     result >>= index & 7;
               ^
      277.     result  &= 1;
      278. #else

libavcodec/get_bits.h:277:5: 
      275. #ifdef BITSTREAM_READER_LE
      276.     result >>= index & 7;
      277.     result  &= 1;
               ^
      278. #else
      279.     result <<= index & 7;

libavcodec/get_bits.h:283:9: Taking false branch
      281. #endif
      282. #if !UNCHECKED_BITSTREAM_READER
      283.     if (s->index < s->size_in_bits_plus8)
                   ^
      284. #endif
      285.         index++;

libavcodec/get_bits.h:286:5: 
      284. #endif
      285.         index++;
      286.     s->index = index;
               ^
      287. 
      288.     return result;

libavcodec/get_bits.h:288:5: 
      286.     s->index = index;
      287. 
      288.     return result;
               ^
      289. }
      290. 

libavcodec/get_bits.h:289:1: return from a call to get_bits1
      287. 
      288.     return result;
      289. }
           ^
      290. 
      291. static inline unsigned int show_bits1(GetBitContext *s)

libavcodec/flac.c:65:5: Skipping get_bits(): empty list of specs
    63. 
    64.     /* block size and sample rate codes */
    65.     bs_code = get_bits(gb, 4);
            ^
    66.     sr_code = get_bits(gb, 4);
    67. 

libavcodec/flac.c:66:5: Skipping get_bits(): empty list of specs
    64.     /* block size and sample rate codes */
    65.     bs_code = get_bits(gb, 4);
    66.     sr_code = get_bits(gb, 4);
            ^
    67. 
    68.     /* channels and decorrelation */

libavcodec/flac.c:69:5: Skipping get_bits(): empty list of specs
    67. 
    68.     /* channels and decorrelation */
    69.     fi->ch_mode = get_bits(gb, 4);
            ^
    70.     if (fi->ch_mode < FLAC_MAX_CHANNELS) {
    71.         fi->channels = fi->ch_mode + 1;

libavcodec/flac.c:70:9: Taking true branch
    68.     /* channels and decorrelation */
    69.     fi->ch_mode = get_bits(gb, 4);
    70.     if (fi->ch_mode < FLAC_MAX_CHANNELS) {
                ^
    71.         fi->channels = fi->ch_mode + 1;
    72.         fi->ch_mode = FLAC_CHMODE_INDEPENDENT;

libavcodec/flac.c:71:9: 
    69.     fi->ch_mode = get_bits(gb, 4);
    70.     if (fi->ch_mode < FLAC_MAX_CHANNELS) {
    71.         fi->channels = fi->ch_mode + 1;
                ^
    72.         fi->ch_mode = FLAC_CHMODE_INDEPENDENT;
    73.     } else if (fi->ch_mode < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE) {

libavcodec/flac.c:72:9: 
    70.     if (fi->ch_mode < FLAC_MAX_CHANNELS) {
    71.         fi->channels = fi->ch_mode + 1;
    72.         fi->ch_mode = FLAC_CHMODE_INDEPENDENT;
                ^
    73.     } else if (fi->ch_mode < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE) {
    74.         fi->channels = 2;

libavcodec/flac.c:83:5: Skipping get_bits(): empty list of specs
    81. 
    82.     /* bits per sample */
    83.     bps_code = get_bits(gb, 3);
            ^
    84.     if (bps_code == 3 || bps_code == 7) {
    85.         av_log(avctx, AV_LOG_ERROR + log_level_offset,

libavcodec/flac.c:84:9: Taking false branch
    82.     /* bits per sample */
    83.     bps_code = get_bits(gb, 3);
    84.     if (bps_code == 3 || bps_code == 7) {
                ^
    85.         av_log(avctx, AV_LOG_ERROR + log_level_offset,
    86.                "invalid sample size code (%d)\n",

libavcodec/flac.c:84:26: Taking false branch
    82.     /* bits per sample */
    83.     bps_code = get_bits(gb, 3);
    84.     if (bps_code == 3 || bps_code == 7) {
                                 ^
    85.         av_log(avctx, AV_LOG_ERROR + log_level_offset,
    86.                "invalid sample size code (%d)\n",

libavcodec/flac.c:90:5: 
    88.         return -1;
    89.     }
    90.     fi->bps = sample_size_table[bps_code];
            ^
    91. 
    92.     /* reserved bit */

libavcodec/flac.c:93:9: 
    91. 
    92.     /* reserved bit */
    93.     if (get_bits1(gb)) {
                ^
    94.         av_log(avctx, AV_LOG_ERROR + log_level_offset,
    95.                "broken stream, invalid padding\n");

libavcodec/get_bits.h:271:1: start of procedure get_bits1()
      269. }
      270. 
      271. static inline unsigned int get_bits1(GetBitContext *s)
           ^
      272. {
      273.     unsigned int index = s->index;

libavcodec/get_bits.h:273:5: 
      271. static inline unsigned int get_bits1(GetBitContext *s)
      272. {
      273.     unsigned int index = s->index;
               ^
      274.     uint8_t result     = s->buffer[index >> 3];
      275. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:274:5: 
      272. {
      273.     unsigned int index = s->index;
      274.     uint8_t result     = s->buffer[index >> 3];
               ^
      275. #ifdef BITSTREAM_READER_LE
      276.     result >>= index & 7;
