libavcodec/mjpegbdec.c:56: error: Null Dereference
  pointer `&hgb->buffer` last assigned on line 54 could be null and is dereferenced by call to `skip_bits()` at line 56, column 5.

libavcodec/mjpegbdec.c:32:1: start of procedure mjpegb_decode_frame()
30. 
31. 
32. static int mjpegb_decode_frame(AVCodecContext *avctx,
    ^
33.                               void *data, int *data_size,
34.                               AVPacket *avpkt)

libavcodec/mjpegbdec.c:36:5: 
34.                               AVPacket *avpkt)
35. {
36.     const uint8_t *buf = avpkt->data;
        ^
37.     int buf_size = avpkt->size;
38.     MJpegDecodeContext *s = avctx->priv_data;

libavcodec/mjpegbdec.c:37:5: 
35. {
36.     const uint8_t *buf = avpkt->data;
37.     int buf_size = avpkt->size;
        ^
38.     MJpegDecodeContext *s = avctx->priv_data;
39.     const uint8_t *buf_end, *buf_ptr;

libavcodec/mjpegbdec.c:38:5: 
36.     const uint8_t *buf = avpkt->data;
37.     int buf_size = avpkt->size;
38.     MJpegDecodeContext *s = avctx->priv_data;
        ^
39.     const uint8_t *buf_end, *buf_ptr;
40.     AVFrame *picture = data;

libavcodec/mjpegbdec.c:40:5: 
38.     MJpegDecodeContext *s = avctx->priv_data;
39.     const uint8_t *buf_end, *buf_ptr;
40.     AVFrame *picture = data;
        ^
41.     GetBitContext hgb; /* for the header */
42.     uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs;

libavcodec/mjpegbdec.c:45:5: 
43.     uint32_t field_size, sod_offs;
44. 
45.     buf_ptr = buf;
        ^
46.     buf_end = buf + buf_size;
47. 

libavcodec/mjpegbdec.c:46:5: 
44. 
45.     buf_ptr = buf;
46.     buf_end = buf + buf_size;
        ^
47. 
48. read_header:

libavcodec/mjpegbdec.c:118:13: 
116.             buf_ptr = buf + second_field_offs;
117.             second_field_offs = 0;
118.             goto read_header;
                 ^
119.             }
120.     }

libavcodec/mjpegbdec.c:50:5: 
48. read_header:
49.     /* reset on every SOI */
50.     s->restart_interval = 0;
        ^
51.     s->restart_count = 0;
52.     s->mjpb_skiptosod = 0;

libavcodec/mjpegbdec.c:51:5: 
49.     /* reset on every SOI */
50.     s->restart_interval = 0;
51.     s->restart_count = 0;
        ^
52.     s->mjpb_skiptosod = 0;
53. 

libavcodec/mjpegbdec.c:52:5: 
50.     s->restart_interval = 0;
51.     s->restart_count = 0;
52.     s->mjpb_skiptosod = 0;
        ^
53. 
54.     init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);

libavcodec/mjpegbdec.c:54:5: 
52.     s->mjpb_skiptosod = 0;
53. 
54.     init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
        ^
55. 
56.     skip_bits(&hgb, 32); /* reserved zeros */

libavcodec/get_bits.h:493:1: start of procedure init_get_bits()
  491.  * @param bit_size the size of the buffer in bits
  492.  */
  493. static inline void init_get_bits(GetBitContext *s,
       ^
  494.                    const uint8_t *buffer, int bit_size)
  495. {

libavcodec/get_bits.h:496:5: 
  494.                    const uint8_t *buffer, int bit_size)
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
           ^
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:497:8: Taking true branch
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
              ^
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;

libavcodec/get_bits.h:498:9: 
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
               ^
  499.         buffer = NULL;
  500.     }

libavcodec/get_bits.h:499:9: 
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;
               ^
  500.     }
  501. 

libavcodec/get_bits.h:502:5: 
  500.     }
  501. 
  502.     s->buffer= buffer;
           ^
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;

libavcodec/get_bits.h:503:5: 
  501. 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
           ^
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER

libavcodec/get_bits.h:504:5: 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;
           ^
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;

libavcodec/get_bits.h:506:5: 
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;
           ^
  507. #elif defined LIBMPEG2_BITSTREAM_READER
  508.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/get_bits.h:516:1: return from a call to init_get_bits
  514.     skip_bits_long(s, 0);
  515. #endif
  516. }
       ^
  517. 
  518. static inline void align_get_bits(GetBitContext *s)

libavcodec/mjpegbdec.c:56:5: 
54.     init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
55. 
56.     skip_bits(&hgb, 32); /* reserved zeros */
        ^
57. 
58.     if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g'))

libavcodec/get_bits.h:408:1: start of procedure skip_bits()
  406. }
  407. 
  408. static inline void skip_bits(GetBitContext *s, int n){
       ^
  409.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  410.     OPEN_READER(re, s)

libavcodec/get_bits.h:410:5: 
  408. static inline void skip_bits(GetBitContext *s, int n){
  409.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  410.     OPEN_READER(re, s)
           ^
  411.     UPDATE_CACHE(re, s)
  412.     LAST_SKIP_BITS(re, s, n)

libavcodec/get_bits.h:411:5: 
  409.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  410.     OPEN_READER(re, s)
  411.     UPDATE_CACHE(re, s)
           ^
  412.     LAST_SKIP_BITS(re, s, n)
  413.     CLOSE_READER(re, s)
