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

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

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

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

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

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

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

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

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

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

libavcodec/flacdec.c:495:9: 
493. 
494.     if (s->max_framesize == 0) {
495.         s->max_framesize =
             ^
496.             ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE,
497.                                        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 ff_flac_is_extradata_valid(AVCodecContext *avctx,

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

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

libavutil/ppc/intreadwrite.h:73:1: start of procedure av_read_bswap32()
  71. }
  72. 
  73. static av_always_inline uint32_t av_read_bswap32(const void *p)
      ^
  74. {
  75.     uint32_t v;

libavutil/ppc/intreadwrite.h:76:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
  74. {
  75.     uint32_t v;
  76.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
          ^
  77.     return v;
  78. }

libavutil/ppc/intreadwrite.h:77:5: 
  75.     uint32_t v;
  76.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
  77.     return v;
          ^
  78. }
  79. 

libavutil/ppc/intreadwrite.h:78:1: return from a call to av_read_bswap32
  76.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
  77.     return v;
  78. }
      ^
  79. 
  80. static av_always_inline void av_write_bswap32(void *p, uint32_t v)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 AVERROR_INVALIDDATA;

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:272:1: start of procedure get_bits1()
      270. }
      271. 
      272. static inline unsigned int get_bits1(GetBitContext *s)
           ^
      273. {
      274.     unsigned int index = s->index;

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

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

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

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

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

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

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

libavcodec/get_bits.h:290:1: return from a call to get_bits1
      288. 
      289.     return result;
      290. }
           ^
      291. 
      292. 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 AVERROR_INVALIDDATA;
    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:272:1: start of procedure get_bits1()
      270. }
      271. 
      272. static inline unsigned int get_bits1(GetBitContext *s)
           ^
      273. {
      274.     unsigned int index = s->index;

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

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