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

libavformat/rtpdec_mpeg4.c:162:1: start of procedure aac_parse_packet()
160. 
161. /* Follows RFC 3640 */
162. static int aac_parse_packet(AVFormatContext *ctx,
     ^
163.                             PayloadContext *data,
164.                             AVStream *st,

libavformat/rtpdec_mpeg4.c:169:9: Taking false branch
167.                             const uint8_t *buf, int len, int flags)
168. {
169.     if (rtp_parse_mp4_au(data, buf))
             ^
170.         return -1;
171. 

libavformat/rtpdec_mpeg4.c:172:5: 
170.         return -1;
171. 
172.     buf += data->au_headers_length_bytes + 2;
         ^
173.     len -= data->au_headers_length_bytes + 2;
174. 

libavformat/rtpdec_mpeg4.c:173:5: 
171. 
172.     buf += data->au_headers_length_bytes + 2;
173.     len -= data->au_headers_length_bytes + 2;
         ^
174. 
175.     /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define

libavformat/rtpdec_mpeg4.c:177:5: 
175.     /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define
176.                     one au_header */
177.     av_new_packet(pkt, data->au_headers[0].size);
         ^
178.     memcpy(pkt->data, buf, data->au_headers[0].size);
179. 

libavcodec/avpacket.c:56:1: start of procedure av_new_packet()
  54. }
  55. 
  56. int av_new_packet(AVPacket *pkt, int size)
      ^
  57. {
  58.     uint8_t *data = NULL;

libavcodec/avpacket.c:58:5: 
  56. int av_new_packet(AVPacket *pkt, int size)
  57. {
  58.     uint8_t *data = NULL;
          ^
  59.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  60.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:59:9: Taking true branch
  57. {
  58.     uint8_t *data = NULL;
  59.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
              ^
  60.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  61.     if (data) {

libavcodec/avpacket.c:60:9: 
  58.     uint8_t *data = NULL;
  59.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  60.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
              ^
  61.     if (data) {
  62.         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:72:9: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX-32) || !size)
                ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX-32) || !size)
    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, size_t size)

libavcodec/avpacket.c:61:9: Taking false branch
  59.     if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  60.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
  61.     if (data) {
              ^
  62.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  63.     } else

libavcodec/avpacket.c:64:9: 
  62.         memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  63.     } else
  64.         size = 0;
              ^
  65. 
  66.     av_init_packet(pkt);

libavcodec/avpacket.c:66:5: 
  64.         size = 0;
  65. 
  66.     av_init_packet(pkt);
          ^
  67.     pkt->data     = data;
  68.     pkt->size     = size;

libavcodec/avpacket.c:42:1: start of procedure av_init_packet()
    40. }
    41. 
    42. void av_init_packet(AVPacket *pkt)
        ^
    43. {
    44.     pkt->pts                  = AV_NOPTS_VALUE;

libavcodec/avpacket.c:44:5: 
    42. void av_init_packet(AVPacket *pkt)
    43. {
    44.     pkt->pts                  = AV_NOPTS_VALUE;
            ^
    45.     pkt->dts                  = AV_NOPTS_VALUE;
    46.     pkt->pos                  = -1;

libavcodec/avpacket.c:45:5: 
    43. {
    44.     pkt->pts                  = AV_NOPTS_VALUE;
    45.     pkt->dts                  = AV_NOPTS_VALUE;
            ^
    46.     pkt->pos                  = -1;
    47.     pkt->duration             = 0;

libavcodec/avpacket.c:46:5: 
    44.     pkt->pts                  = AV_NOPTS_VALUE;
    45.     pkt->dts                  = AV_NOPTS_VALUE;
    46.     pkt->pos                  = -1;
            ^
    47.     pkt->duration             = 0;
    48.     pkt->convergence_duration = 0;

libavcodec/avpacket.c:47:5: 
    45.     pkt->dts                  = AV_NOPTS_VALUE;
    46.     pkt->pos                  = -1;
    47.     pkt->duration             = 0;
            ^
    48.     pkt->convergence_duration = 0;
    49.     pkt->flags                = 0;

libavcodec/avpacket.c:48:5: 
    46.     pkt->pos                  = -1;
    47.     pkt->duration             = 0;
    48.     pkt->convergence_duration = 0;
            ^
    49.     pkt->flags                = 0;
    50.     pkt->stream_index         = 0;

libavcodec/avpacket.c:49:5: 
    47.     pkt->duration             = 0;
    48.     pkt->convergence_duration = 0;
    49.     pkt->flags                = 0;
            ^
    50.     pkt->stream_index         = 0;
    51.     pkt->destruct             = NULL;

libavcodec/avpacket.c:50:5: 
    48.     pkt->convergence_duration = 0;
    49.     pkt->flags                = 0;
    50.     pkt->stream_index         = 0;
            ^
    51.     pkt->destruct             = NULL;
    52.     pkt->side_data            = NULL;

libavcodec/avpacket.c:51:5: 
    49.     pkt->flags                = 0;
    50.     pkt->stream_index         = 0;
    51.     pkt->destruct             = NULL;
            ^
    52.     pkt->side_data            = NULL;
    53.     pkt->side_data_elems      = 0;

libavcodec/avpacket.c:52:5: 
    50.     pkt->stream_index         = 0;
    51.     pkt->destruct             = NULL;
    52.     pkt->side_data            = NULL;
            ^
    53.     pkt->side_data_elems      = 0;
    54. }

libavcodec/avpacket.c:53:5: 
    51.     pkt->destruct             = NULL;
    52.     pkt->side_data            = NULL;
    53.     pkt->side_data_elems      = 0;
            ^
    54. }
    55. 

libavcodec/avpacket.c:54:1: return from a call to av_init_packet
    52.     pkt->side_data            = NULL;
    53.     pkt->side_data_elems      = 0;
    54. }
        ^
    55. 
    56. int av_new_packet(AVPacket *pkt, int size)

libavcodec/avpacket.c:67:5: 
  65. 
  66.     av_init_packet(pkt);
  67.     pkt->data     = data;
          ^
  68.     pkt->size     = size;
  69.     pkt->destruct = av_destruct_packet;

libavcodec/avpacket.c:68:5: 
  66.     av_init_packet(pkt);
  67.     pkt->data     = data;
  68.     pkt->size     = size;
          ^
  69.     pkt->destruct = av_destruct_packet;
  70.     if (!data)

libavcodec/avpacket.c:69:5: 
  67.     pkt->data     = data;
  68.     pkt->size     = size;
  69.     pkt->destruct = av_destruct_packet;
          ^
  70.     if (!data)
  71.         return AVERROR(ENOMEM);

libavcodec/avpacket.c:70:10: Taking true branch
  68.     pkt->size     = size;
  69.     pkt->destruct = av_destruct_packet;
  70.     if (!data)
               ^
  71.         return AVERROR(ENOMEM);
  72.     return 0;

libavcodec/avpacket.c:71:9: 
  69.     pkt->destruct = av_destruct_packet;
  70.     if (!data)
  71.         return AVERROR(ENOMEM);
              ^
  72.     return 0;
  73. }

libavcodec/avpacket.c:73:1: return from a call to av_new_packet
  71.         return AVERROR(ENOMEM);
  72.     return 0;
  73. }
      ^
  74. 
  75. void av_shrink_packet(AVPacket *pkt, int size)

libavformat/rtpdec_mpeg4.c:178:5: 
176.                     one au_header */
177.     av_new_packet(pkt, data->au_headers[0].size);
178.     memcpy(pkt->data, buf, data->au_headers[0].size);
         ^
179. 
180.     pkt->stream_index = st->index;

static int aac_parse_packet(AVFormatContext *ctx,
                            PayloadContext *data,
                            AVStream *st,
                            AVPacket *pkt,
                            uint32_t *timestamp,
                            const uint8_t *buf, int len, int flags)
{
    if (rtp_parse_mp4_au(data, buf))
        return -1;
    buf += data->au_headers_length_bytes + 2;
    len -= data->au_headers_length_bytes + 2;
    av_new_packet(pkt, data->au_headers[0].size);
    memcpy(pkt->data, buf, data->au_headers[0].size);
    pkt->stream_index = st->index;
    return 0;
}
['static int aac_parse_packet(AVFormatContext *ctx,\n                            PayloadContext *data,\n                            AVStream *st,\n                            AVPacket *pkt,\n                            uint32_t *timestamp,\n                            const uint8_t *buf, int len, int flags)\n{\n    if (rtp_parse_mp4_au(data, buf))\n        return -1;\n    buf += data->au_headers_length_bytes + 2;\n    len -= data->au_headers_length_bytes + 2;\n    av_new_packet(pkt, data->au_headers[0].size);\n    memcpy(pkt->data, buf, data->au_headers[0].size);\n    pkt->stream_index = st->index;\n    return 0;\n}', 'int av_new_packet(AVPacket *pkt, int size)\n{\n    uint8_t *data = NULL;\n    if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)\n        data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);\n    if (data) {\n        memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);\n    } else\n        size = 0;\n    av_init_packet(pkt);\n    pkt->data     = data;\n    pkt->size     = size;\n    pkt->destruct = av_destruct_packet;\n    if (!data)\n        return AVERROR(ENOMEM);\n    return 0;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if (size > (INT_MAX-32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+32);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&31) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,32,size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'void av_init_packet(AVPacket *pkt)\n{\n    pkt->pts                  = AV_NOPTS_VALUE;\n    pkt->dts                  = AV_NOPTS_VALUE;\n    pkt->pos                  = -1;\n    pkt->duration             = 0;\n    pkt->convergence_duration = 0;\n    pkt->flags                = 0;\n    pkt->stream_index         = 0;\n    pkt->destruct             = NULL;\n    pkt->side_data            = NULL;\n    pkt->side_data_elems      = 0;\n}']