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

libavformat/rtpdec.c:419:1: start of procedure rtp_parse_packet_internal()
417. }
418. 
419. static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
     ^
420.                                      const uint8_t *buf, int len)
421. {

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

libavformat/rtpdec.c:426:5: 
424.     AVStream *st;
425.     uint32_t timestamp;
426.     int rv= 0;
         ^
427. 
428.     payload_type = buf[1] & 0x7f;

libavformat/rtpdec.c:428:5: 
426.     int rv= 0;
427. 
428.     payload_type = buf[1] & 0x7f;
         ^
429.     if (buf[1] & 0x80)
430.         flags |= RTP_FLAG_MARKER;

libavformat/rtpdec.c:429:9: Taking true branch
427. 
428.     payload_type = buf[1] & 0x7f;
429.     if (buf[1] & 0x80)
             ^
430.         flags |= RTP_FLAG_MARKER;
431.     seq  = AV_RB16(buf + 2);

libavformat/rtpdec.c:430:9: 
428.     payload_type = buf[1] & 0x7f;
429.     if (buf[1] & 0x80)
430.         flags |= RTP_FLAG_MARKER;
             ^
431.     seq  = AV_RB16(buf + 2);
432.     timestamp = AV_RB32(buf + 4);

libavformat/rtpdec.c:431:5: 
429.     if (buf[1] & 0x80)
430.         flags |= RTP_FLAG_MARKER;
431.     seq  = AV_RB16(buf + 2);
         ^
432.     timestamp = AV_RB32(buf + 4);
433.     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:432:5: 
430.         flags |= RTP_FLAG_MARKER;
431.     seq  = AV_RB16(buf + 2);
432.     timestamp = AV_RB32(buf + 4);
         ^
433.     ssrc = AV_RB32(buf + 8);
434.     /* 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:433:5: 
431.     seq  = AV_RB16(buf + 2);
432.     timestamp = AV_RB32(buf + 4);
433.     ssrc = AV_RB32(buf + 8);
         ^
434.     /* store the ssrc in the RTPDemuxContext */
435.     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:435:5: 
433.     ssrc = AV_RB32(buf + 8);
434.     /* store the ssrc in the RTPDemuxContext */
435.     s->ssrc = ssrc;
         ^
436. 
437.     /* NOTE: we can handle only one payload type */

libavformat/rtpdec.c:438:9: Taking false branch
436. 
437.     /* NOTE: we can handle only one payload type */
438.     if (s->payload_type != payload_type)
             ^
439.         return -1;
440. 

libavformat/rtpdec.c:441:5: 
439.         return -1;
440. 
441.     st = s->st;
         ^
442.     // only do something with this if all the rtp checks pass...
443.     if(!rtp_valid_packet_in_sequence(&s->statistics, seq))

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

libavformat/rtpdec.c:140:1: start of procedure rtp_valid_packet_in_sequence()
  138. * returns 1 if we should handle this packet.
  139. */
  140. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
       ^
  141. {
  142.     uint16_t udelta= seq - s->max_seq;

libavformat/rtpdec.c:142:5: 
  140. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
  141. {
  142.     uint16_t udelta= seq - s->max_seq;
           ^
  143.     const int MAX_DROPOUT= 3000;
  144.     const int MAX_MISORDER = 100;

libavformat/rtpdec.c:143:5: 
  141. {
  142.     uint16_t udelta= seq - s->max_seq;
  143.     const int MAX_DROPOUT= 3000;
           ^
  144.     const int MAX_MISORDER = 100;
  145.     const int MIN_SEQUENTIAL = 2;

libavformat/rtpdec.c:144:5: 
  142.     uint16_t udelta= seq - s->max_seq;
  143.     const int MAX_DROPOUT= 3000;
  144.     const int MAX_MISORDER = 100;
           ^
  145.     const int MIN_SEQUENTIAL = 2;
  146. 

libavformat/rtpdec.c:145:5: 
  143.     const int MAX_DROPOUT= 3000;
  144.     const int MAX_MISORDER = 100;
  145.     const int MIN_SEQUENTIAL = 2;
           ^
  146. 
  147.     /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */

libavformat/rtpdec.c:148:8: Taking false branch
  146. 
  147.     /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
  148.     if(s->probation)
              ^
  149.     {
  150.         if(seq==s->max_seq + 1) {

libavformat/rtpdec.c:162:16: Taking false branch
  160.             s->max_seq = seq;
  161.         }
  162.     } else if (udelta < MAX_DROPOUT) {
                      ^
  163.         // in order, with permissible gap
  164.         if(seq < s->max_seq) {

libavformat/rtpdec.c:169:16: Taking false branch
  167.         }
  168.         s->max_seq= seq;
  169.     } else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
                      ^
  170.         // sequence made a large jump...
  171.         if(seq==s->bad_seq) {

libavformat/rtpdec.c:181:5: 
  179.         // duplicate or reordered packet...
  180.     }
  181.     s->received++;
           ^
  182.     return 1;
  183. }

libavformat/rtpdec.c:182:5: 
  180.     }
  181.     s->received++;
  182.     return 1;
           ^
  183. }
  184. 

libavformat/rtpdec.c:183:1: return from a call to rtp_valid_packet_in_sequence
  181.     s->received++;
  182.     return 1;
  183. }
       ^
  184. 
  185. #if 0

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

libavformat/rtpdec.c:450:5: 
448.     }
449. 
450.     s->seq = seq;
         ^
451.     len -= 12;
452.     buf += 12;

libavformat/rtpdec.c:451:5: 
449. 
450.     s->seq = seq;
451.     len -= 12;
         ^
452.     buf += 12;
453. 

libavformat/rtpdec.c:452:5: 
450.     s->seq = seq;
451.     len -= 12;
452.     buf += 12;
         ^
453. 
454.     if (!st) {

libavformat/rtpdec.c:454:10: Taking false branch
452.     buf += 12;
453. 
454.     if (!st) {
              ^
455.         /* specific MPEG2TS demux support */
456.         ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len);

libavformat/rtpdec.c:466:16: Taking false branch
464.         }
465.         return 0;
466.     } else if (s->parse_packet) {
                    ^
467.         rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
468.                              s->st, pkt, &timestamp, buf, len, flags);

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

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

libavformat/rtpdec.c:475:17: Taking false branch
473.         case CODEC_ID_MP3:
474.             /* better than nothing: skip mpeg audio RTP header */
475.             if (len <= 4)
                     ^
476.                 return -1;
477.             h = AV_RB32(buf);

libavformat/rtpdec.c:477:13: 
475.             if (len <= 4)
476.                 return -1;
477.             h = AV_RB32(buf);
                 ^
478.             len -= 4;
479.             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:478:13: 
476.                 return -1;
477.             h = AV_RB32(buf);
478.             len -= 4;
                 ^
479.             buf += 4;
480.             av_new_packet(pkt, len);

libavformat/rtpdec.c:479:13: 
477.             h = AV_RB32(buf);
478.             len -= 4;
479.             buf += 4;
                 ^
480.             av_new_packet(pkt, len);
481.             memcpy(pkt->data, buf, len);

libavformat/rtpdec.c:480:13: 
478.             len -= 4;
479.             buf += 4;
480.             av_new_packet(pkt, len);
                 ^
481.             memcpy(pkt->data, buf, len);
482.             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:481:13: 
479.             buf += 4;
480.             av_new_packet(pkt, len);
481.             memcpy(pkt->data, buf, len);
                 ^
482.             break;
483.         case CODEC_ID_MPEG1VIDEO:
