libavformat/rtpdec.c:518: error: Null Dereference
  pointer `pkt->data` last assigned on line 517 could be null and is dereferenced by call to `memcpy()` at line 518, column 13.

libavformat/rtpdec.c:422:1: start of procedure rtp_parse_packet()
420.  * (use buf as NULL to read the next). -1 if no packet (error or no more packet).
421.  */
422. int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
     ^
423.                      const uint8_t *buf, int len)
424. {

libavformat/rtpdec.c:426:5: 
424. {
425.     unsigned int ssrc, h;
426.     int payload_type, seq, ret, flags = 0;
         ^
427.     AVStream *st;
428.     uint32_t timestamp;

libavformat/rtpdec.c:429:5: 
427.     AVStream *st;
428.     uint32_t timestamp;
429.     int rv= 0;
         ^
430. 
431.     if (!buf) {

libavformat/rtpdec.c:431:10: Taking false branch
429.     int rv= 0;
430. 
431.     if (!buf) {
              ^
432.         /* return the next packets, if any */
433.         if(s->st && s->parse_packet) {

libavformat/rtpdec.c:457:9: Taking false branch
455.     }
456. 
457.     if (len < 12)
             ^
458.         return -1;
459. 

libavformat/rtpdec.c:460:9: Taking false branch
458.         return -1;
459. 
460.     if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
             ^
461.         return -1;
462.     if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) {

libavformat/rtpdec.c:462:9: Taking false branch
460.     if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
461.         return -1;
462.     if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) {
             ^
463.         return rtcp_parse_packet(s, buf, len);
464.     }

libavformat/rtpdec.c:465:5: 
463.         return rtcp_parse_packet(s, buf, len);
464.     }
465.     payload_type = buf[1] & 0x7f;
         ^
466.     if (buf[1] & 0x80)
467.         flags |= RTP_FLAG_MARKER;

libavformat/rtpdec.c:466:9: Taking true branch
464.     }
465.     payload_type = buf[1] & 0x7f;
466.     if (buf[1] & 0x80)
             ^
467.         flags |= RTP_FLAG_MARKER;
468.     seq  = AV_RB16(buf + 2);

libavformat/rtpdec.c:467:9: 
465.     payload_type = buf[1] & 0x7f;
466.     if (buf[1] & 0x80)
467.         flags |= RTP_FLAG_MARKER;
             ^
468.     seq  = AV_RB16(buf + 2);
469.     timestamp = AV_RB32(buf + 4);

libavformat/rtpdec.c:468:5: 
466.     if (buf[1] & 0x80)
467.         flags |= RTP_FLAG_MARKER;
468.     seq  = AV_RB16(buf + 2);
         ^
469.     timestamp = AV_RB32(buf + 4);
470.     ssrc = AV_RB32(buf + 8);

libavutil/bswap.h:58:1: start of procedure av_bswap16()
  56. 
  57. #ifndef av_bswap16
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
      ^
  59. {
  60.     x= (x>>8) | (x<<8);

libavutil/bswap.h:60:5: 
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
  59. {
  60.     x= (x>>8) | (x<<8);
          ^
  61.     return x;
  62. }

libavutil/bswap.h:61:5: 
  59. {
  60.     x= (x>>8) | (x<<8);
  61.     return x;
          ^
  62. }
  63. #endif

libavutil/bswap.h:62:1: return from a call to av_bswap16
  60.     x= (x>>8) | (x<<8);
  61.     return x;
  62. }
      ^
  63. #endif
  64. 

libavformat/rtpdec.c:469:5: 
467.         flags |= RTP_FLAG_MARKER;
468.     seq  = AV_RB16(buf + 2);
469.     timestamp = AV_RB32(buf + 4);
         ^
470.     ssrc = AV_RB32(buf + 8);
471.     /* store the ssrc in the RTPDemuxContext */

libavutil/bswap.h:66:1: start of procedure av_bswap32()
  64. 
  65. #ifndef av_bswap32
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      ^
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:68:5: 
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
          ^
  69.     x= (x>>16) | (x<<16);
  70.     return x;

libavutil/bswap.h:69:5: 
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
          ^
  70.     return x;
  71. }

libavutil/bswap.h:70:5: 
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
  70.     return x;
          ^
  71. }
  72. #endif

libavutil/bswap.h:71:1: return from a call to av_bswap32
  69.     x= (x>>16) | (x<<16);
  70.     return x;
  71. }
      ^
  72. #endif
  73. 

libavformat/rtpdec.c:470:5: 
468.     seq  = AV_RB16(buf + 2);
469.     timestamp = AV_RB32(buf + 4);
470.     ssrc = AV_RB32(buf + 8);
         ^
471.     /* store the ssrc in the RTPDemuxContext */
472.     s->ssrc = ssrc;

libavutil/bswap.h:66:1: start of procedure av_bswap32()
  64. 
  65. #ifndef av_bswap32
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      ^
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:68:5: 
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
          ^
  69.     x= (x>>16) | (x<<16);
  70.     return x;

libavutil/bswap.h:69:5: 
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
          ^
  70.     return x;
  71. }

libavutil/bswap.h:70:5: 
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
  70.     return x;
          ^
  71. }
  72. #endif

libavutil/bswap.h:71:1: return from a call to av_bswap32
  69.     x= (x>>16) | (x<<16);
  70.     return x;
  71. }
      ^
  72. #endif
  73. 

libavformat/rtpdec.c:472:5: 
470.     ssrc = AV_RB32(buf + 8);
471.     /* store the ssrc in the RTPDemuxContext */
472.     s->ssrc = ssrc;
         ^
473. 
474.     /* NOTE: we can handle only one payload type */

libavformat/rtpdec.c:475:9: Taking false branch
473. 
474.     /* NOTE: we can handle only one payload type */
475.     if (s->payload_type != payload_type)
             ^
476.         return -1;
477. 

libavformat/rtpdec.c:478:5: 
476.         return -1;
477. 
478.     st = s->st;
         ^
479.     // only do something with this if all the rtp checks pass...
480.     if(!rtp_valid_packet_in_sequence(&s->statistics, seq))

libavformat/rtpdec.c:480:9: 
478.     st = s->st;
479.     // only do something with this if all the rtp checks pass...
480.     if(!rtp_valid_packet_in_sequence(&s->statistics, seq))
             ^
481.     {
482.         av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",

libavformat/rtpdec.c:135:1: start of procedure rtp_valid_packet_in_sequence()
  133. * returns 1 if we should handle this packet.
  134. */
  135. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
       ^
  136. {
  137.     uint16_t udelta= seq - s->max_seq;

libavformat/rtpdec.c:137:5: 
  135. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
  136. {
  137.     uint16_t udelta= seq - s->max_seq;
           ^
  138.     const int MAX_DROPOUT= 3000;
  139.     const int MAX_MISORDER = 100;

libavformat/rtpdec.c:138:5: 
  136. {
  137.     uint16_t udelta= seq - s->max_seq;
  138.     const int MAX_DROPOUT= 3000;
           ^
  139.     const int MAX_MISORDER = 100;
  140.     const int MIN_SEQUENTIAL = 2;

libavformat/rtpdec.c:139:5: 
  137.     uint16_t udelta= seq - s->max_seq;
  138.     const int MAX_DROPOUT= 3000;
  139.     const int MAX_MISORDER = 100;
           ^
  140.     const int MIN_SEQUENTIAL = 2;
  141. 

libavformat/rtpdec.c:140:5: 
  138.     const int MAX_DROPOUT= 3000;
  139.     const int MAX_MISORDER = 100;
  140.     const int MIN_SEQUENTIAL = 2;
           ^
  141. 
  142.     /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */

libavformat/rtpdec.c:143:8: Taking false branch
  141. 
  142.     /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
  143.     if(s->probation)
              ^
  144.     {
  145.         if(seq==s->max_seq + 1) {

libavformat/rtpdec.c:157:16: Taking false branch
  155.             s->max_seq = seq;
  156.         }
  157.     } else if (udelta < MAX_DROPOUT) {
                      ^
  158.         // in order, with permissible gap
  159.         if(seq < s->max_seq) {

libavformat/rtpdec.c:164:16: Taking false branch
  162.         }
  163.         s->max_seq= seq;
  164.     } else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
                      ^
  165.         // sequence made a large jump...
  166.         if(seq==s->bad_seq) {

libavformat/rtpdec.c:176:5: 
  174.         // duplicate or reordered packet...
  175.     }
  176.     s->received++;
           ^
  177.     return 1;
  178. }

libavformat/rtpdec.c:177:5: 
  175.     }
  176.     s->received++;
  177.     return 1;
           ^
  178. }
  179. 

libavformat/rtpdec.c:178:1: return from a call to rtp_valid_packet_in_sequence
  176.     s->received++;
  177.     return 1;
  178. }
       ^
  179. 
  180. #if 0

libavformat/rtpdec.c:480:9: Taking false branch
478.     st = s->st;
479.     // only do something with this if all the rtp checks pass...
480.     if(!rtp_valid_packet_in_sequence(&s->statistics, seq))
             ^
481.     {
482.         av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",

libavformat/rtpdec.c:487:5: 
485.     }
486. 
487.     s->seq = seq;
         ^
488.     len -= 12;
489.     buf += 12;

libavformat/rtpdec.c:488:5: 
486. 
487.     s->seq = seq;
488.     len -= 12;
         ^
489.     buf += 12;
490. 

libavformat/rtpdec.c:489:5: 
487.     s->seq = seq;
488.     len -= 12;
489.     buf += 12;
         ^
490. 
491.     if (!st) {

libavformat/rtpdec.c:491:10: Taking false branch
489.     buf += 12;
490. 
491.     if (!st) {
              ^
492.         /* specific MPEG2TS demux support */
493.         ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len);

libavformat/rtpdec.c:503:16: Taking false branch
501.         }
502.         return 0;
503.     } else if (s->parse_packet) {
                    ^
504.         rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
505.                              s->st, pkt, &timestamp, buf, len, flags);

libavformat/rtpdec.c:508:9: 
506.     } else {
507.         // at this point, the RTP header has been stripped;  This is ASSUMING that there is only 1 CSRC, which in't wise.
508.         switch(st->codec->codec_id) {
             ^
509.         case CODEC_ID_MP2:
510.         case CODEC_ID_MP3:

libavformat/rtpdec.c:509:9: Switch condition is true. Entering switch case
507.         // at this point, the RTP header has been stripped;  This is ASSUMING that there is only 1 CSRC, which in't wise.
508.         switch(st->codec->codec_id) {
509.         case CODEC_ID_MP2:
             ^
510.         case CODEC_ID_MP3:
511.             /* better than nothing: skip mpeg audio RTP header */

libavformat/rtpdec.c:512:17: Taking false branch
510.         case CODEC_ID_MP3:
511.             /* better than nothing: skip mpeg audio RTP header */
512.             if (len <= 4)
                     ^
513.                 return -1;
514.             h = AV_RB32(buf);

libavformat/rtpdec.c:514:13: 
512.             if (len <= 4)
513.                 return -1;
514.             h = AV_RB32(buf);
                 ^
515.             len -= 4;
516.             buf += 4;

libavutil/bswap.h:66:1: start of procedure av_bswap32()
  64. 
  65. #ifndef av_bswap32
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      ^
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:68:5: 
  66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
          ^
  69.     x= (x>>16) | (x<<16);
  70.     return x;

libavutil/bswap.h:69:5: 
  67. {
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
          ^
  70.     return x;
  71. }

libavutil/bswap.h:70:5: 
  68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
  69.     x= (x>>16) | (x<<16);
  70.     return x;
          ^
  71. }
  72. #endif

libavutil/bswap.h:71:1: return from a call to av_bswap32
  69.     x= (x>>16) | (x<<16);
  70.     return x;
  71. }
      ^
  72. #endif
  73. 

libavformat/rtpdec.c:515:13: 
513.                 return -1;
514.             h = AV_RB32(buf);
515.             len -= 4;
                 ^
516.             buf += 4;
517.             av_new_packet(pkt, len);

libavformat/rtpdec.c:516:13: 
514.             h = AV_RB32(buf);
515.             len -= 4;
516.             buf += 4;
                 ^
517.             av_new_packet(pkt, len);
518.             memcpy(pkt->data, buf, len);

libavformat/rtpdec.c:517:13: 
515.             len -= 4;
516.             buf += 4;
517.             av_new_packet(pkt, len);
                 ^
518.             memcpy(pkt->data, buf, len);
519.             break;

libavcodec/avpacket.c:48:1: start of procedure av_new_packet()
  46. }
  47. 
  48. int av_new_packet(AVPacket *pkt, int size)
      ^
  49. {
  50.     uint8_t *data= NULL;

libavcodec/avpacket.c:50:5: 
  48. int av_new_packet(AVPacket *pkt, int size)
  49. {
  50.     uint8_t *data= NULL;
          ^
  51.     if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  52.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:51:8: Taking true branch
  49. {
  50.     uint8_t *data= NULL;
  51.     if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
             ^
  52.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  53.     if (data){

libavcodec/avpacket.c:52:9: 
  50.     uint8_t *data= NULL;
  51.     if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  52.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
              ^
  53.     if (data){
  54.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.    linker will do it automatically. */
    63. 
    64. void *av_malloc(unsigned int size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(unsigned int size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:8: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-16) )
               ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-16) )
    73.         return NULL;
                ^
    74. 
    75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, unsigned int size)

libavcodec/avpacket.c:53:9: Taking false branch
  51.     if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  52.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  53.     if (data){
              ^
  54.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  55.     }else

libavcodec/avpacket.c:56:9: 
  54.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  55.     }else
  56.         size=0;
              ^
  57. 
  58.     av_init_packet(pkt);

libavcodec/avpacket.c:58:5: 
  56.         size=0;
  57. 
  58.     av_init_packet(pkt);
          ^
  59.     pkt->data = data;
  60.     pkt->size = size;

libavcodec/avpacket.c:36:1: start of procedure av_init_packet()
    34. }
    35. 
    36. void av_init_packet(AVPacket *pkt)
        ^
    37. {
    38.     pkt->pts   = AV_NOPTS_VALUE;

libavcodec/avpacket.c:38:5: 
    36. void av_init_packet(AVPacket *pkt)
    37. {
    38.     pkt->pts   = AV_NOPTS_VALUE;
            ^
    39.     pkt->dts   = AV_NOPTS_VALUE;
    40.     pkt->pos   = -1;

libavcodec/avpacket.c:39:5: 
    37. {
    38.     pkt->pts   = AV_NOPTS_VALUE;
    39.     pkt->dts   = AV_NOPTS_VALUE;
            ^
    40.     pkt->pos   = -1;
    41.     pkt->duration = 0;

libavcodec/avpacket.c:40:5: 
    38.     pkt->pts   = AV_NOPTS_VALUE;
    39.     pkt->dts   = AV_NOPTS_VALUE;
    40.     pkt->pos   = -1;
            ^
    41.     pkt->duration = 0;
    42.     pkt->convergence_duration = 0;

libavcodec/avpacket.c:41:5: 
    39.     pkt->dts   = AV_NOPTS_VALUE;
    40.     pkt->pos   = -1;
    41.     pkt->duration = 0;
            ^
    42.     pkt->convergence_duration = 0;
    43.     pkt->flags = 0;

libavcodec/avpacket.c:42:5: 
    40.     pkt->pos   = -1;
    41.     pkt->duration = 0;
    42.     pkt->convergence_duration = 0;
            ^
    43.     pkt->flags = 0;
    44.     pkt->stream_index = 0;

libavcodec/avpacket.c:43:5: 
    41.     pkt->duration = 0;
    42.     pkt->convergence_duration = 0;
    43.     pkt->flags = 0;
            ^
    44.     pkt->stream_index = 0;
    45.     pkt->destruct= NULL;

libavcodec/avpacket.c:44:5: 
    42.     pkt->convergence_duration = 0;
    43.     pkt->flags = 0;
    44.     pkt->stream_index = 0;
            ^
    45.     pkt->destruct= NULL;
    46. }

libavcodec/avpacket.c:45:5: 
    43.     pkt->flags = 0;
    44.     pkt->stream_index = 0;
    45.     pkt->destruct= NULL;
            ^
    46. }
    47. 

libavcodec/avpacket.c:46:1: return from a call to av_init_packet
    44.     pkt->stream_index = 0;
    45.     pkt->destruct= NULL;
    46. }
        ^
    47. 
    48. int av_new_packet(AVPacket *pkt, int size)

libavcodec/avpacket.c:59:5: 
  57. 
  58.     av_init_packet(pkt);
  59.     pkt->data = data;
          ^
  60.     pkt->size = size;
  61.     pkt->destruct = av_destruct_packet;

libavcodec/avpacket.c:60:5: 
  58.     av_init_packet(pkt);
  59.     pkt->data = data;
  60.     pkt->size = size;
          ^
  61.     pkt->destruct = av_destruct_packet;
  62.     if(!data)

libavcodec/avpacket.c:61:5: 
  59.     pkt->data = data;
  60.     pkt->size = size;
  61.     pkt->destruct = av_destruct_packet;
          ^
  62.     if(!data)
  63.         return AVERROR(ENOMEM);

libavcodec/avpacket.c:62:9: Taking true branch
  60.     pkt->size = size;
  61.     pkt->destruct = av_destruct_packet;
  62.     if(!data)
              ^
  63.         return AVERROR(ENOMEM);
  64.     return 0;

libavcodec/avpacket.c:63:9: 
  61.     pkt->destruct = av_destruct_packet;
  62.     if(!data)
  63.         return AVERROR(ENOMEM);
              ^
  64.     return 0;
  65. }

libavcodec/avpacket.c:65:1: return from a call to av_new_packet
  63.         return AVERROR(ENOMEM);
  64.     return 0;
  65. }
      ^
  66. 
  67. void av_shrink_packet(AVPacket *pkt, int size)

libavformat/rtpdec.c:518:13: 
516.             buf += 4;
517.             av_new_packet(pkt, len);
518.             memcpy(pkt->data, buf, len);
                 ^
519.             break;
520.         case CODEC_ID_MPEG1VIDEO:
