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

libavformat/rtpdec_h264.c:167:1: start of procedure h264_handle_packet()
165. 
166. // return 0 on packet, no more left, 1 on packet, 1 on partial packet
167. static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
     ^
168.                               AVStream *st, AVPacket *pkt, uint32_t *timestamp,
169.                               const uint8_t *buf, int len, int flags)

libavformat/rtpdec_h264.c:173:5: 
171.     uint8_t nal;
172.     uint8_t type;
173.     int result = 0;
         ^
174. 
175.     if (!len) {

libavformat/rtpdec_h264.c:175:10: Taking false branch
173.     int result = 0;
174. 
175.     if (!len) {
              ^
176.         av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n");
177.         return AVERROR_INVALIDDATA;

libavformat/rtpdec_h264.c:179:5: 
177.         return AVERROR_INVALIDDATA;
178.     }
179.     nal  = buf[0];
         ^
180.     type = nal & 0x1f;
181. 

libavformat/rtpdec_h264.c:180:5: 
178.     }
179.     nal  = buf[0];
180.     type = nal & 0x1f;
         ^
181. 
182.     assert(data);

libavformat/rtpdec_h264.c:182:5: 
180.     type = nal & 0x1f;
181. 
182.     assert(data);
         ^
183.     assert(buf);
184. 

libavformat/rtpdec_h264.c:183:5: 
181. 
182.     assert(data);
183.     assert(buf);
         ^
184. 
185.     /* Simplify the case (these are all the nal types used internally by

libavformat/rtpdec_h264.c:187:9: Taking true branch
185.     /* Simplify the case (these are all the nal types used internally by
186.      * the h264 codec). */
187.     if (type >= 1 && type <= 23)
             ^
188.         type = 1;
189.     switch (type) {

libavformat/rtpdec_h264.c:187:22: Taking true branch
185.     /* Simplify the case (these are all the nal types used internally by
186.      * the h264 codec). */
187.     if (type >= 1 && type <= 23)
                          ^
188.         type = 1;
189.     switch (type) {

libavformat/rtpdec_h264.c:188:9: 
186.      * the h264 codec). */
187.     if (type >= 1 && type <= 23)
188.         type = 1;
             ^
189.     switch (type) {
190.     case 0:                    // undefined, but pass them through

libavformat/rtpdec_h264.c:189:5: 
187.     if (type >= 1 && type <= 23)
188.         type = 1;
189.     switch (type) {
         ^
190.     case 0:                    // undefined, but pass them through
191.     case 1:

libavformat/rtpdec_h264.c:190:5: Switch condition is false. Skipping switch case
188.         type = 1;
189.     switch (type) {
190.     case 0:                    // undefined, but pass them through
         ^
191.     case 1:
192.         av_new_packet(pkt, len + sizeof(start_sequence));

libavformat/rtpdec_h264.c:191:5: Switch condition is true. Entering switch case
189.     switch (type) {
190.     case 0:                    // undefined, but pass them through
191.     case 1:
         ^
192.         av_new_packet(pkt, len + sizeof(start_sequence));
193.         memcpy(pkt->data, start_sequence, sizeof(start_sequence));

libavformat/rtpdec_h264.c:192:9: 
190.     case 0:                    // undefined, but pass them through
191.     case 1:
192.         av_new_packet(pkt, len + sizeof(start_sequence));
             ^
193.         memcpy(pkt->data, start_sequence, sizeof(start_sequence));
194.         memcpy(pkt->data + sizeof(start_sequence), buf, len);

libavcodec/avpacket.c:61:1: start of procedure av_new_packet()
  59. }
  60. 
  61. int av_new_packet(AVPacket *pkt, int size)
      ^
  62. {
  63.     uint8_t *data = NULL;

libavcodec/avpacket.c:63:5: 
  61. int av_new_packet(AVPacket *pkt, int size)
  62. {
  63.     uint8_t *data = NULL;
          ^
  64.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  65.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:64:9: Taking true branch
  62. {
  63.     uint8_t *data = NULL;
  64.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
              ^
  65.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  66.     if (data) {

libavcodec/avpacket.c:65:9: 
  63.     uint8_t *data = NULL;
  64.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  65.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
              ^
  66.     if (data) {
  67.         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(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

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

libavutil/mem.c:71:5: 
    69. #endif
    70. 
    71.     assert(size);
            ^
    72. 
    73.     /* let's disallow possible ambiguous cases */

libavutil/mem.c:74:9: Taking true branch
    72. 
    73.     /* let's disallow possible ambiguous cases */
    74.     if (size > (INT_MAX-32) || !size)
                ^
    75.         return NULL;
    76. 

libavutil/mem.c:75:9: 
    73.     /* let's disallow possible ambiguous cases */
    74.     if (size > (INT_MAX-32) || !size)
    75.         return NULL;
                ^
    76. 
    77. #if CONFIG_MEMALIGN_HACK

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

libavcodec/avpacket.c:66:9: Taking false branch
  64.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  65.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  66.     if (data) {
              ^
  67.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  68.     } else

libavcodec/avpacket.c:69:9: 
  67.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  68.     } else
  69.         size = 0;
              ^
  70. 
  71.     av_init_packet(pkt);

libavcodec/avpacket.c:71:5: 
  69.         size = 0;
  70. 
  71.     av_init_packet(pkt);
          ^
  72.     pkt->data     = data;
  73.     pkt->size     = size;

libavcodec/avpacket.c:47:1: start of procedure av_init_packet()
    45. }
    46. 
    47. void av_init_packet(AVPacket *pkt)
        ^
    48. {
    49.     pkt->pts                  = AV_NOPTS_VALUE;

libavcodec/avpacket.c:49:5: 
    47. void av_init_packet(AVPacket *pkt)
    48. {
    49.     pkt->pts                  = AV_NOPTS_VALUE;
            ^
    50.     pkt->dts                  = AV_NOPTS_VALUE;
    51.     pkt->pos                  = -1;

libavcodec/avpacket.c:50:5: 
    48. {
    49.     pkt->pts                  = AV_NOPTS_VALUE;
    50.     pkt->dts                  = AV_NOPTS_VALUE;
            ^
    51.     pkt->pos                  = -1;
    52.     pkt->duration             = 0;

libavcodec/avpacket.c:51:5: 
    49.     pkt->pts                  = AV_NOPTS_VALUE;
    50.     pkt->dts                  = AV_NOPTS_VALUE;
    51.     pkt->pos                  = -1;
            ^
    52.     pkt->duration             = 0;
    53.     pkt->convergence_duration = 0;

libavcodec/avpacket.c:52:5: 
    50.     pkt->dts                  = AV_NOPTS_VALUE;
    51.     pkt->pos                  = -1;
    52.     pkt->duration             = 0;
            ^
    53.     pkt->convergence_duration = 0;
    54.     pkt->flags                = 0;

libavcodec/avpacket.c:53:5: 
    51.     pkt->pos                  = -1;
    52.     pkt->duration             = 0;
    53.     pkt->convergence_duration = 0;
            ^
    54.     pkt->flags                = 0;
    55.     pkt->stream_index         = 0;

libavcodec/avpacket.c:54:5: 
    52.     pkt->duration             = 0;
    53.     pkt->convergence_duration = 0;
    54.     pkt->flags                = 0;
            ^
    55.     pkt->stream_index         = 0;
    56.     pkt->destruct             = NULL;

libavcodec/avpacket.c:55:5: 
    53.     pkt->convergence_duration = 0;
    54.     pkt->flags                = 0;
    55.     pkt->stream_index         = 0;
            ^
    56.     pkt->destruct             = NULL;
    57.     pkt->side_data            = NULL;

libavcodec/avpacket.c:56:5: 
    54.     pkt->flags                = 0;
    55.     pkt->stream_index         = 0;
    56.     pkt->destruct             = NULL;
            ^
    57.     pkt->side_data            = NULL;
    58.     pkt->side_data_elems      = 0;

libavcodec/avpacket.c:57:5: 
    55.     pkt->stream_index         = 0;
    56.     pkt->destruct             = NULL;
    57.     pkt->side_data            = NULL;
            ^
    58.     pkt->side_data_elems      = 0;
    59. }

libavcodec/avpacket.c:58:5: 
    56.     pkt->destruct             = NULL;
    57.     pkt->side_data            = NULL;
    58.     pkt->side_data_elems      = 0;
            ^
    59. }
    60. 

libavcodec/avpacket.c:59:1: return from a call to av_init_packet
    57.     pkt->side_data            = NULL;
    58.     pkt->side_data_elems      = 0;
    59. }
        ^
    60. 
    61. int av_new_packet(AVPacket *pkt, int size)

libavcodec/avpacket.c:72:5: 
  70. 
  71.     av_init_packet(pkt);
  72.     pkt->data     = data;
          ^
  73.     pkt->size     = size;
  74.     pkt->destruct = av_destruct_packet;

libavcodec/avpacket.c:73:5: 
  71.     av_init_packet(pkt);
  72.     pkt->data     = data;
  73.     pkt->size     = size;
          ^
  74.     pkt->destruct = av_destruct_packet;
  75.     if (!data)

libavcodec/avpacket.c:74:5: 
  72.     pkt->data     = data;
  73.     pkt->size     = size;
  74.     pkt->destruct = av_destruct_packet;
          ^
  75.     if (!data)
  76.         return AVERROR(ENOMEM);

libavcodec/avpacket.c:75:10: Taking true branch
  73.     pkt->size     = size;
  74.     pkt->destruct = av_destruct_packet;
  75.     if (!data)
               ^
  76.         return AVERROR(ENOMEM);
  77.     return 0;

libavcodec/avpacket.c:76:9: 
  74.     pkt->destruct = av_destruct_packet;
  75.     if (!data)
  76.         return AVERROR(ENOMEM);
              ^
  77.     return 0;
  78. }

libavcodec/avpacket.c:78:1: return from a call to av_new_packet
  76.         return AVERROR(ENOMEM);
  77.     return 0;
  78. }
      ^
  79. 
  80. void av_shrink_packet(AVPacket *pkt, int size)

libavformat/rtpdec_h264.c:193:9: 
191.     case 1:
192.         av_new_packet(pkt, len + sizeof(start_sequence));
193.         memcpy(pkt->data, start_sequence, sizeof(start_sequence));
             ^
194.         memcpy(pkt->data + sizeof(start_sequence), buf, len);
195.         COUNT_NAL_TYPE(data, nal);
