libavcodec/motionpixels.c:310: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 306 could be null and is dereferenced by call to `get_bits()` at line 310, column 18.

libavcodec/motionpixels.c:282:1: start of procedure mp_decode_frame()
280. }
281. 
282. static int mp_decode_frame(AVCodecContext *avctx,
     ^
283.                                  void *data, int *data_size,
284.                                  AVPacket *avpkt)

libavcodec/motionpixels.c:286:5: 
284.                                  AVPacket *avpkt)
285. {
286.     const uint8_t *buf = avpkt->data;
         ^
287.     int buf_size = avpkt->size;
288.     MotionPixelsContext *mp = avctx->priv_data;

libavcodec/motionpixels.c:287:5: 
285. {
286.     const uint8_t *buf = avpkt->data;
287.     int buf_size = avpkt->size;
         ^
288.     MotionPixelsContext *mp = avctx->priv_data;
289.     GetBitContext gb;

libavcodec/motionpixels.c:288:5: 
286.     const uint8_t *buf = avpkt->data;
287.     int buf_size = avpkt->size;
288.     MotionPixelsContext *mp = avctx->priv_data;
         ^
289.     GetBitContext gb;
290.     int i, count1, count2, sz;

libavcodec/motionpixels.c:292:5: 
290.     int i, count1, count2, sz;
291. 
292.     mp->frame.reference = 1;
         ^
293.     mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
294.     if (avctx->reget_buffer(avctx, &mp->frame)) {

libavcodec/motionpixels.c:293:5: 
291. 
292.     mp->frame.reference = 1;
293.     mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
         ^
294.     if (avctx->reget_buffer(avctx, &mp->frame)) {
295.         av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");

libavcodec/motionpixels.c:294:9: Taking false branch
292.     mp->frame.reference = 1;
293.     mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
294.     if (avctx->reget_buffer(avctx, &mp->frame)) {
             ^
295.         av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
296.         return -1;

libavcodec/motionpixels.c:300:5: 
298. 
299.     /* le32 bitstream msb first */
300.     av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
         ^
301.     if (!mp->bswapbuf)
302.         AVERROR(ENOMEM);

libavcodec/utils.c:83:1: start of procedure av_fast_malloc()
  81. }
  82. 
  83. void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)
      ^
  84. {
  85.     void **p = ptr;

libavcodec/utils.c:85:5: 
  83. void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)
  84. {
  85.     void **p = ptr;
          ^
  86.     if (min_size < *size)
  87.         return;

libavcodec/utils.c:86:9: Taking true branch
  84. {
  85.     void **p = ptr;
  86.     if (min_size < *size)
              ^
  87.         return;
  88.     *size= FFMAX(17*min_size/16 + 32, min_size);

libavcodec/utils.c:87:9: 
  85.     void **p = ptr;
  86.     if (min_size < *size)
  87.         return;
              ^
  88.     *size= FFMAX(17*min_size/16 + 32, min_size);
  89.     av_free(*p);

libavcodec/utils.c:92:1: return from a call to av_fast_malloc
  90.     *p = av_malloc(*size);
  91.     if (!*p) *size = 0;
  92. }
      ^
  93. 
  94. /* encoder management */

libavcodec/motionpixels.c:301:10: Taking false branch
299.     /* le32 bitstream msb first */
300.     av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
301.     if (!mp->bswapbuf)
              ^
302.         AVERROR(ENOMEM);
303.     mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);

libavcodec/motionpixels.c:303:5: Skipping __function_pointer__(): unresolved function pointer
301.     if (!mp->bswapbuf)
302.         AVERROR(ENOMEM);
303.     mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
         ^
304.     if (buf_size & 3)
305.         memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);

libavcodec/motionpixels.c:304:9: Taking true branch
302.         AVERROR(ENOMEM);
303.     mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
304.     if (buf_size & 3)
             ^
305.         memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
306.     init_get_bits(&gb, mp->bswapbuf, buf_size * 8);

libavcodec/motionpixels.c:305:9: 
303.     mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
304.     if (buf_size & 3)
305.         memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
             ^
306.     init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
307. 

libavcodec/motionpixels.c:306:5: 
304.     if (buf_size & 3)
305.         memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
306.     init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
         ^
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);

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/motionpixels.c:308:5: 
306.     init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
         ^
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
310.         count1 = get_bits(&gb, 12);

libavcodec/motionpixels.c:309:16: Condition is false
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
                    ^
310.         count1 = get_bits(&gb, 12);
311.         count2 = get_bits(&gb, 12);

libavcodec/motionpixels.c:309:14: 
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
                  ^
310.         count1 = get_bits(&gb, 12);
311.         count2 = get_bits(&gb, 12);

libavcodec/motionpixels.c:309:10: 
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
              ^
310.         count1 = get_bits(&gb, 12);
311.         count2 = get_bits(&gb, 12);

libavcodec/motionpixels.c:309:42: Loop condition is true. Entering loop body
307. 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
                                              ^
310.         count1 = get_bits(&gb, 12);
311.         count2 = get_bits(&gb, 12);

libavcodec/motionpixels.c:310:9: 
308.     memset(mp->changes_map, 0, avctx->width * avctx->height);
309.     for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
310.         count1 = get_bits(&gb, 12);
             ^
311.         count2 = get_bits(&gb, 12);
312.         mp_read_changes_map(mp, &gb, count1, 8, i);

libavcodec/get_bits.h:385:1: start of procedure get_bits()
  383.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
  384.  */
  385. static inline unsigned int get_bits(GetBitContext *s, int n){
       ^
  386.     register int tmp;
  387.     OPEN_READER(re, s)

libavcodec/get_bits.h:387:5: 
  385. static inline unsigned int get_bits(GetBitContext *s, int n){
  386.     register int tmp;
  387.     OPEN_READER(re, s)
           ^
  388.     UPDATE_CACHE(re, s)
  389.     tmp= SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:388:5: 
  386.     register int tmp;
  387.     OPEN_READER(re, s)
  388.     UPDATE_CACHE(re, s)
           ^
  389.     tmp= SHOW_UBITS(re, s, n);
  390.     LAST_SKIP_BITS(re, s, n)
