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

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

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

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

libavcodec/h264_parser.c:115:5: 
113.     unsigned int pps_id;
114.     unsigned int slice_type;
115.     int state = -1;
         ^
116.     const uint8_t *ptr;
117. 

libavcodec/h264_parser.c:119:5: 
117. 
118.     /* set some sane default values */
119.     s->pict_type = AV_PICTURE_TYPE_I;
         ^
120.     s->key_frame = 0;
121. 

libavcodec/h264_parser.c:120:5: 
118.     /* set some sane default values */
119.     s->pict_type = AV_PICTURE_TYPE_I;
120.     s->key_frame = 0;
         ^
121. 
122.     h->s.avctx= avctx;

libavcodec/h264_parser.c:122:5: 
120.     s->key_frame = 0;
121. 
122.     h->s.avctx= avctx;
         ^
123.     h->sei_recovery_frame_cnt = -1;
124.     h->sei_dpb_output_delay         =  0;

libavcodec/h264_parser.c:123:5: 
121. 
122.     h->s.avctx= avctx;
123.     h->sei_recovery_frame_cnt = -1;
         ^
124.     h->sei_dpb_output_delay         =  0;
125.     h->sei_cpb_removal_delay        = -1;

libavcodec/h264_parser.c:124:5: 
122.     h->s.avctx= avctx;
123.     h->sei_recovery_frame_cnt = -1;
124.     h->sei_dpb_output_delay         =  0;
         ^
125.     h->sei_cpb_removal_delay        = -1;
126.     h->sei_buffering_period_present =  0;

libavcodec/h264_parser.c:125:5: 
123.     h->sei_recovery_frame_cnt = -1;
124.     h->sei_dpb_output_delay         =  0;
125.     h->sei_cpb_removal_delay        = -1;
         ^
126.     h->sei_buffering_period_present =  0;
127. 

libavcodec/h264_parser.c:126:5: 
124.     h->sei_dpb_output_delay         =  0;
125.     h->sei_cpb_removal_delay        = -1;
126.     h->sei_buffering_period_present =  0;
         ^
127. 
128.     if (!buf_size)

libavcodec/h264_parser.c:128:10: Taking false branch
126.     h->sei_buffering_period_present =  0;
127. 
128.     if (!buf_size)
              ^
129.         return 0;
130. 

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

libavcodec/h264_parser.c:133:9: Skipping avpriv_mpv_find_start_code(): empty list of specs
131.     for(;;) {
132.         int src_length, dst_length, consumed;
133.         buf = avpriv_mpv_find_start_code(buf, buf_end, &state);
             ^
134.         if(buf >= buf_end)
135.             break;

libavcodec/h264_parser.c:134:12: Taking false branch
132.         int src_length, dst_length, consumed;
133.         buf = avpriv_mpv_find_start_code(buf, buf_end, &state);
134.         if(buf >= buf_end)
                ^
135.             break;
136.         --buf;

libavcodec/h264_parser.c:136:9: 
134.         if(buf >= buf_end)
135.             break;
136.         --buf;
             ^
137.         src_length = buf_end - buf;
138.         switch (state & 0x1f) {

libavcodec/h264_parser.c:137:9: 
135.             break;
136.         --buf;
137.         src_length = buf_end - buf;
             ^
138.         switch (state & 0x1f) {
139.         case NAL_SLICE:

libavcodec/h264_parser.c:138:9: 
136.         --buf;
137.         src_length = buf_end - buf;
138.         switch (state & 0x1f) {
             ^
139.         case NAL_SLICE:
140.         case NAL_IDR_SLICE:

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

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

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

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

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

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

libavcodec/h264_parser.c:152:9: Switch condition is true. Entering switch case
150.         init_get_bits(&h->s.gb, ptr, 8*dst_length);
151.         switch(h->nal_unit_type) {
152.         case NAL_SPS:
             ^
153.             ff_h264_decode_seq_parameter_set(h);
154.             break;

libavcodec/h264_parser.c:153:13: 
151.         switch(h->nal_unit_type) {
152.         case NAL_SPS:
153.             ff_h264_decode_seq_parameter_set(h);
                 ^
154.             break;
155.         case NAL_PPS:

libavcodec/h264_ps.c:303:1: start of procedure ff_h264_decode_seq_parameter_set()
  301. }
  302. 
  303. int ff_h264_decode_seq_parameter_set(H264Context *h){
       ^
  304.     MpegEncContext * const s = &h->s;
  305.     int profile_idc, level_idc, constraint_set_flags = 0;

libavcodec/h264_ps.c:304:5: 
  302. 
  303. int ff_h264_decode_seq_parameter_set(H264Context *h){
  304.     MpegEncContext * const s = &h->s;
           ^
  305.     int profile_idc, level_idc, constraint_set_flags = 0;
  306.     unsigned int sps_id;

libavcodec/h264_ps.c:305:5: 
  303. int ff_h264_decode_seq_parameter_set(H264Context *h){
  304.     MpegEncContext * const s = &h->s;
  305.     int profile_idc, level_idc, constraint_set_flags = 0;
           ^
  306.     unsigned int sps_id;
  307.     int i, log2_max_frame_num_minus4;

libavcodec/h264_ps.c:310:5: Skipping get_bits(): empty list of specs
  308.     SPS *sps;
  309. 
  310.     profile_idc= get_bits(&s->gb, 8);
           ^
  311.     constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
  312.     constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag

libavcodec/h264_ps.c:311:5: 
  309. 
  310.     profile_idc= get_bits(&s->gb, 8);
  311.     constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
           ^
  312.     constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
  313.     constraint_set_flags |= get_bits1(&s->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:312:5: 
  310.     profile_idc= get_bits(&s->gb, 8);
  311.     constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
  312.     constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
           ^
  313.     constraint_set_flags |= get_bits1(&s->gb) << 2;   //constraint_set2_flag
  314.     constraint_set_flags |= get_bits1(&s->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:313:5: 
  311.     constraint_set_flags |= get_bits1(&s->gb) << 0;   //constraint_set0_flag
  312.     constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
  313.     constraint_set_flags |= get_bits1(&s->gb) << 2;   //constraint_set2_flag
           ^
  314.     constraint_set_flags |= get_bits1(&s->gb) << 3;   //constraint_set3_flag
  315.     get_bits(&s->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:314:5: 
  312.     constraint_set_flags |= get_bits1(&s->gb) << 1;   //constraint_set1_flag
  313.     constraint_set_flags |= get_bits1(&s->gb) << 2;   //constraint_set2_flag
  314.     constraint_set_flags |= get_bits1(&s->gb) << 3;   //constraint_set3_flag
           ^
  315.     get_bits(&s->gb, 4); // reserved
  316.     level_idc= get_bits(&s->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;
