libavcodec/flac_parser.c:97: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 96 could be null and is dereferenced by call to `ff_flac_decode_frame_header()` at line 97, column 13.

libavcodec/flac_parser.c:92:1: start of procedure frame_header_is_valid()
90. } FLACParseContext;
91. 
92. static int frame_header_is_valid(AVCodecContext *avctx, const uint8_t *buf,
    ^
93.                                  FLACFrameInfo *fi)
94. {

libavcodec/flac_parser.c:96:5: 
94. {
95.     GetBitContext gb;
96.     init_get_bits(&gb, buf, MAX_FRAME_HEADER_SIZE * 8);
        ^
97.     return !ff_flac_decode_frame_header(avctx, &gb, fi, 127);
98. }

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 false 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:382:35: Taking false 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:382:52: 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/flac_parser.c:97:13: 
95.     GetBitContext gb;
96.     init_get_bits(&gb, buf, MAX_FRAME_HEADER_SIZE * 8);
97.     return !ff_flac_decode_frame_header(avctx, &gb, fi, 127);
                ^
98. }
99. 

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 false 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:73:16: Taking true branch
  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;
  75.         fi->ch_mode -= FLAC_MAX_CHANNELS - 1;

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

libavcodec/flac.c:75:9: 
  73.     } else if (fi->ch_mode < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE) {
  74.         fi->channels = 2;
  75.         fi->ch_mode -= FLAC_MAX_CHANNELS - 1;
              ^
  76.     } else {
  77.         av_log(avctx, AV_LOG_ERROR + log_level_offset,

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;
