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

libavcodec/h264_parser.c:109:1: start of procedure parse_nal_units()
107.  * @param buf_size size of the buffer.
108.  */
109. static inline int parse_nal_units(AVCodecParserContext *s,
     ^
110.                                   AVCodecContext *avctx,
111.                                   const uint8_t *buf, int buf_size)

libavcodec/h264_parser.c:113:5: 
111.                                   const uint8_t *buf, int buf_size)
112. {
113.     H264Context *h = s->priv_data;
         ^
114.     const uint8_t *buf_end = buf + buf_size;
115.     unsigned int pps_id;

libavcodec/h264_parser.c:114:5: 
112. {
113.     H264Context *h = s->priv_data;
114.     const uint8_t *buf_end = buf + buf_size;
         ^
115.     unsigned int pps_id;
116.     unsigned int slice_type;

libavcodec/h264_parser.c:117:5: 
115.     unsigned int pps_id;
116.     unsigned int slice_type;
117.     int state = -1;
         ^
118.     const uint8_t *ptr;
119.     int field_poc[2];

libavcodec/h264_parser.c:122:5: 
120. 
121.     /* set some sane default values */
122.     s->pict_type = AV_PICTURE_TYPE_I;
         ^
123.     s->key_frame = 0;
124.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;

libavcodec/h264_parser.c:123:5: 
121.     /* set some sane default values */
122.     s->pict_type = AV_PICTURE_TYPE_I;
123.     s->key_frame = 0;
         ^
124.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
125. 

libavcodec/h264_parser.c:124:5: 
122.     s->pict_type = AV_PICTURE_TYPE_I;
123.     s->key_frame = 0;
124.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
         ^
125. 
126.     h->avctx= avctx;

libavcodec/h264_parser.c:126:5: 
124.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
125. 
126.     h->avctx= avctx;
         ^
127.     h->sei_recovery_frame_cnt = -1;
128.     h->sei_dpb_output_delay         =  0;

libavcodec/h264_parser.c:127:5: 
125. 
126.     h->avctx= avctx;
127.     h->sei_recovery_frame_cnt = -1;
         ^
128.     h->sei_dpb_output_delay         =  0;
129.     h->sei_cpb_removal_delay        = -1;

libavcodec/h264_parser.c:128:5: 
126.     h->avctx= avctx;
127.     h->sei_recovery_frame_cnt = -1;
128.     h->sei_dpb_output_delay         =  0;
         ^
129.     h->sei_cpb_removal_delay        = -1;
130.     h->sei_buffering_period_present =  0;

libavcodec/h264_parser.c:129:5: 
127.     h->sei_recovery_frame_cnt = -1;
128.     h->sei_dpb_output_delay         =  0;
129.     h->sei_cpb_removal_delay        = -1;
         ^
130.     h->sei_buffering_period_present =  0;
131. 

libavcodec/h264_parser.c:130:5: 
128.     h->sei_dpb_output_delay         =  0;
129.     h->sei_cpb_removal_delay        = -1;
130.     h->sei_buffering_period_present =  0;
         ^
131. 
132.     if (!buf_size)

libavcodec/h264_parser.c:132:10: Taking false branch
130.     h->sei_buffering_period_present =  0;
131. 
132.     if (!buf_size)
              ^
133.         return 0;
134. 

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

libavcodec/h264_parser.c:137:9: Skipping avpriv_find_start_code(): empty list of specs
135.     for(;;) {
136.         int src_length, dst_length, consumed;
137.         buf = avpriv_find_start_code(buf, buf_end, &state);
             ^
138.         if(buf >= buf_end)
139.             break;

libavcodec/h264_parser.c:138:12: Taking false branch
136.         int src_length, dst_length, consumed;
137.         buf = avpriv_find_start_code(buf, buf_end, &state);
138.         if(buf >= buf_end)
                ^
139.             break;
140.         --buf;

libavcodec/h264_parser.c:140:9: 
138.         if(buf >= buf_end)
139.             break;
140.         --buf;
             ^
141.         src_length = buf_end - buf;
142.         switch (state & 0x1f) {

libavcodec/h264_parser.c:141:9: 
139.             break;
140.         --buf;
141.         src_length = buf_end - buf;
             ^
142.         switch (state & 0x1f) {
143.         case NAL_SLICE:

libavcodec/h264_parser.c:142:9: 
140.         --buf;
141.         src_length = buf_end - buf;
142.         switch (state & 0x1f) {
             ^
143.         case NAL_SLICE:
144.         case NAL_IDR_SLICE:

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

libavcodec/h264_parser.c:146:17: Taking false branch
144.         case NAL_IDR_SLICE:
145.             // Do not walk the whole buffer just to decode slice header
146.             if (src_length > 20)
                     ^
147.                 src_length = 20;
148.             break;

libavcodec/h264_parser.c:150:9: Skipping ff_h264_decode_nal(): empty list of specs
148.             break;
149.         }
150.         ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
             ^
151.         if (ptr==NULL || dst_length < 0)
152.             break;

libavcodec/h264_parser.c:151:13: Taking false branch
149.         }
150.         ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
151.         if (ptr==NULL || dst_length < 0)
                 ^
152.             break;
153. 

libavcodec/h264_parser.c:151:26: Taking false branch
149.         }
150.         ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
151.         if (ptr==NULL || dst_length < 0)
                              ^
152.             break;
153. 

libavcodec/h264_parser.c:154:9: 
152.             break;
153. 
154.         init_get_bits(&h->gb, ptr, 8*dst_length);
             ^
155.         switch(h->nal_unit_type) {
156.         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:155:9: 
153. 
154.         init_get_bits(&h->gb, ptr, 8*dst_length);
155.         switch(h->nal_unit_type) {
             ^
156.         case NAL_SPS:
157.             ff_h264_decode_seq_parameter_set(h);

libavcodec/h264_parser.c:156:9: Switch condition is true. Entering switch case
154.         init_get_bits(&h->gb, ptr, 8*dst_length);
155.         switch(h->nal_unit_type) {
156.         case NAL_SPS:
             ^
157.             ff_h264_decode_seq_parameter_set(h);
158.             break;

libavcodec/h264_parser.c:157:13: 
155.         switch(h->nal_unit_type) {
156.         case NAL_SPS:
157.             ff_h264_decode_seq_parameter_set(h);
                 ^
158.             break;
159.         case NAL_PPS:

libavcodec/h264_ps.c:298:1: start of procedure ff_h264_decode_seq_parameter_set()
  296. }
  297. 
  298. int ff_h264_decode_seq_parameter_set(H264Context *h){
       ^
  299.     int profile_idc, level_idc, constraint_set_flags = 0;
  300.     unsigned int sps_id;

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

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

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