libavcodec/h264_parser.c:146: error: Null Dereference
  pointer `h->gb.buffer` last assigned on line 143 could be null and is dereferenced by call to `ff_h264_decode_seq_parameter_set()` at line 146, column 13.

libavcodec/h264_parser.c:98:1: start of procedure parse_nal_units()
 96.  * @param buf_size size of the buffer.
 97.  */
 98. static inline int parse_nal_units(AVCodecParserContext *s,
     ^
 99.                                   AVCodecContext *avctx,
100.                                   const uint8_t *buf, int buf_size)

libavcodec/h264_parser.c:102:5: 
100.                                   const uint8_t *buf, int buf_size)
101. {
102.     H264Context *h         = s->priv_data;
         ^
103.     const uint8_t *buf_end = buf + buf_size;
104.     unsigned int pps_id;

libavcodec/h264_parser.c:103:5: 
101. {
102.     H264Context *h         = s->priv_data;
103.     const uint8_t *buf_end = buf + buf_size;
         ^
104.     unsigned int pps_id;
105.     unsigned int slice_type;

libavcodec/h264_parser.c:106:5: 
104.     unsigned int pps_id;
105.     unsigned int slice_type;
106.     int state = -1;
         ^
107.     const uint8_t *ptr;
108.     int field_poc[2];

libavcodec/h264_parser.c:111:5: 
109. 
110.     /* set some sane default values */
111.     s->pict_type         = AV_PICTURE_TYPE_I;
         ^
112.     s->key_frame         = 0;
113.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;

libavcodec/h264_parser.c:112:5: 
110.     /* set some sane default values */
111.     s->pict_type         = AV_PICTURE_TYPE_I;
112.     s->key_frame         = 0;
         ^
113.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
114. 

libavcodec/h264_parser.c:113:5: 
111.     s->pict_type         = AV_PICTURE_TYPE_I;
112.     s->key_frame         = 0;
113.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
         ^
114. 
115.     h->avctx                        = avctx;

libavcodec/h264_parser.c:115:5: 
113.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
114. 
115.     h->avctx                        = avctx;
         ^
116.     h->sei_recovery_frame_cnt       = -1;
117.     h->sei_dpb_output_delay         = 0;

libavcodec/h264_parser.c:116:5: 
114. 
115.     h->avctx                        = avctx;
116.     h->sei_recovery_frame_cnt       = -1;
         ^
117.     h->sei_dpb_output_delay         = 0;
118.     h->sei_cpb_removal_delay        = -1;

libavcodec/h264_parser.c:117:5: 
115.     h->avctx                        = avctx;
116.     h->sei_recovery_frame_cnt       = -1;
117.     h->sei_dpb_output_delay         = 0;
         ^
118.     h->sei_cpb_removal_delay        = -1;
119.     h->sei_buffering_period_present = 0;

libavcodec/h264_parser.c:118:5: 
116.     h->sei_recovery_frame_cnt       = -1;
117.     h->sei_dpb_output_delay         = 0;
118.     h->sei_cpb_removal_delay        = -1;
         ^
119.     h->sei_buffering_period_present = 0;
120. 

libavcodec/h264_parser.c:119:5: 
117.     h->sei_dpb_output_delay         = 0;
118.     h->sei_cpb_removal_delay        = -1;
119.     h->sei_buffering_period_present = 0;
         ^
120. 
121.     if (!buf_size)

libavcodec/h264_parser.c:121:10: Taking false branch
119.     h->sei_buffering_period_present = 0;
120. 
121.     if (!buf_size)
              ^
122.         return 0;
123. 

libavcodec/h264_parser.c:288:5: Loop condition is true. Entering loop body
286.         }
287.         buf += consumed;
288.     }
         ^
289.     /* didn't find a picture! */
290.     av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");

libavcodec/h264_parser.c:126:9: Skipping avpriv_find_start_code(): empty list of specs
124.     for (;;) {
125.         int src_length, dst_length, consumed;
126.         buf = avpriv_find_start_code(buf, buf_end, &state);
             ^
127.         if (buf >= buf_end)
128.             break;

libavcodec/h264_parser.c:127:13: Taking false branch
125.         int src_length, dst_length, consumed;
126.         buf = avpriv_find_start_code(buf, buf_end, &state);
127.         if (buf >= buf_end)
                 ^
128.             break;
129.         --buf;

libavcodec/h264_parser.c:129:9: 
127.         if (buf >= buf_end)
128.             break;
129.         --buf;
             ^
130.         src_length = buf_end - buf;
131.         switch (state & 0x1f) {

libavcodec/h264_parser.c:130:9: 
128.             break;
129.         --buf;
130.         src_length = buf_end - buf;
             ^
131.         switch (state & 0x1f) {
132.         case NAL_SLICE:

libavcodec/h264_parser.c:131:9: 
129.         --buf;
130.         src_length = buf_end - buf;
131.         switch (state & 0x1f) {
             ^
132.         case NAL_SLICE:
133.         case NAL_IDR_SLICE:

libavcodec/h264_parser.c:132:9: Switch condition is true. Entering switch case
130.         src_length = buf_end - buf;
131.         switch (state & 0x1f) {
132.         case NAL_SLICE:
             ^
133.         case NAL_IDR_SLICE:
134.             // Do not walk the whole buffer just to decode slice header

libavcodec/h264_parser.c:135:17: Taking false branch
133.         case NAL_IDR_SLICE:
134.             // Do not walk the whole buffer just to decode slice header
135.             if (src_length > 20)
                     ^
136.                 src_length = 20;
137.             break;

libavcodec/h264_parser.c:139:9: Skipping ff_h264_decode_nal(): empty list of specs
137.             break;
138.         }
139.         ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
             ^
140.         if (ptr == NULL || dst_length < 0)
141.             break;

libavcodec/h264_parser.c:140:13: Taking false branch
138.         }
139.         ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
140.         if (ptr == NULL || dst_length < 0)
                 ^
141.             break;
142. 

libavcodec/h264_parser.c:140:28: Taking false branch
138.         }
139.         ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
140.         if (ptr == NULL || dst_length < 0)
                                ^
141.             break;
142. 

libavcodec/h264_parser.c:143:9: 
141.             break;
142. 
143.         init_get_bits(&h->gb, ptr, 8 * dst_length);
             ^
144.         switch (h->nal_unit_type) {
145.         case NAL_SPS:

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/h264_parser.c:144:9: 
142. 
143.         init_get_bits(&h->gb, ptr, 8 * dst_length);
144.         switch (h->nal_unit_type) {
             ^
145.         case NAL_SPS:
146.             ff_h264_decode_seq_parameter_set(h);

libavcodec/h264_parser.c:145:9: Switch condition is true. Entering switch case
143.         init_get_bits(&h->gb, ptr, 8 * dst_length);
144.         switch (h->nal_unit_type) {
145.         case NAL_SPS:
             ^
146.             ff_h264_decode_seq_parameter_set(h);
147.             break;

libavcodec/h264_parser.c:146:13: 
144.         switch (h->nal_unit_type) {
145.         case NAL_SPS:
146.             ff_h264_decode_seq_parameter_set(h);
                 ^
147.             break;
148.         case NAL_PPS:

libavcodec/h264_ps.c:295:1: start of procedure ff_h264_decode_seq_parameter_set()
  293. }
  294. 
  295. int ff_h264_decode_seq_parameter_set(H264Context *h)
       ^
  296. {
  297.     int profile_idc, level_idc, constraint_set_flags = 0;

libavcodec/h264_ps.c:297:5: 
  295. int ff_h264_decode_seq_parameter_set(H264Context *h)
  296. {
  297.     int profile_idc, level_idc, constraint_set_flags = 0;
           ^
  298.     unsigned int sps_id;
  299.     int i, log2_max_frame_num_minus4;

libavcodec/h264_ps.c:302:5: Skipping get_bits(): empty list of specs
  300.     SPS *sps;
  301. 
  302.     profile_idc           = get_bits(&h->gb, 8);
           ^
  303.     constraint_set_flags |= get_bits1(&h->gb) << 0;   // constraint_set0_flag
  304.     constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag

libavcodec/h264_ps.c:303:5: 
  301. 
  302.     profile_idc           = get_bits(&h->gb, 8);
  303.     constraint_set_flags |= get_bits1(&h->gb) << 0;   // constraint_set0_flag
           ^
  304.     constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
  305.     constraint_set_flags |= get_bits1(&h->gb) << 2;   // constraint_set2_flag

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 true 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:285:9: 
    283.     if (s->index < s->size_in_bits_plus8)
    284. #endif
    285.         index++;
                 ^
    286.     s->index = index;
    287. 

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/h264_ps.c:304:5: 
  302.     profile_idc           = get_bits(&h->gb, 8);
  303.     constraint_set_flags |= get_bits1(&h->gb) << 0;   // constraint_set0_flag
  304.     constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
           ^
  305.     constraint_set_flags |= get_bits1(&h->gb) << 2;   // constraint_set2_flag
  306.     constraint_set_flags |= get_bits1(&h->gb) << 3;   // constraint_set3_flag

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 true 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:285:9: 
    283.     if (s->index < s->size_in_bits_plus8)
    284. #endif
    285.         index++;
                 ^
    286.     s->index = index;
    287. 

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/h264_ps.c:305:5: 
  303.     constraint_set_flags |= get_bits1(&h->gb) << 0;   // constraint_set0_flag
  304.     constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
  305.     constraint_set_flags |= get_bits1(&h->gb) << 2;   // constraint_set2_flag
           ^
  306.     constraint_set_flags |= get_bits1(&h->gb) << 3;   // constraint_set3_flag
  307.     get_bits(&h->gb, 4); // reserved

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 true 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:285:9: 
    283.     if (s->index < s->size_in_bits_plus8)
    284. #endif
    285.         index++;
                 ^
    286.     s->index = index;
    287. 

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/h264_ps.c:306:5: 
  304.     constraint_set_flags |= get_bits1(&h->gb) << 1;   // constraint_set1_flag
  305.     constraint_set_flags |= get_bits1(&h->gb) << 2;   // constraint_set2_flag
  306.     constraint_set_flags |= get_bits1(&h->gb) << 3;   // constraint_set3_flag
           ^
  307.     get_bits(&h->gb, 4); // reserved
  308.     level_idc = get_bits(&h->gb, 8);

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;
