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

libavformat/assdec.c:143:1: start of procedure read_packet()
141. }
142. 
143. static int read_packet(AVFormatContext *s, AVPacket *pkt)
     ^
144. {
145.     ASSContext *ass = s->priv_data;

libavformat/assdec.c:145:5: 
143. static int read_packet(AVFormatContext *s, AVPacket *pkt)
144. {
145.     ASSContext *ass = s->priv_data;
         ^
146.     uint8_t *p, *end;
147. 

libavformat/assdec.c:148:8: Taking false branch
146.     uint8_t *p, *end;
147. 
148.     if(ass->event_index >= ass->event_count)
            ^
149.         return AVERROR(EIO);
150. 

libavformat/assdec.c:151:5: 
149.         return AVERROR(EIO);
150. 
151.     p= ass->event[ ass->event_index ];
         ^
152. 
153.     end= strchr(p, '\n');

libavformat/assdec.c:153:5: 
151.     p= ass->event[ ass->event_index ];
152. 
153.     end= strchr(p, '\n');
         ^
154.     av_new_packet(pkt, end ? end-p+1 : strlen(p));
155.     pkt->flags |= AV_PKT_FLAG_KEY;

libavformat/assdec.c:154:24: Condition is true
152. 
153.     end= strchr(p, '\n');
154.     av_new_packet(pkt, end ? end-p+1 : strlen(p));
                            ^
155.     pkt->flags |= AV_PKT_FLAG_KEY;
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;

libavformat/assdec.c:154:5: 
152. 
153.     end= strchr(p, '\n');
154.     av_new_packet(pkt, end ? end-p+1 : strlen(p));
         ^
155.     pkt->flags |= AV_PKT_FLAG_KEY;
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;

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

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

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

libavcodec/avpacket.c:53:9: 
  51.     uint8_t *data= NULL;
  52.     if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
  53.         data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
              ^
  54.     if (data){
  55.         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(FF_INTERNAL_MEM_TYPE size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(FF_INTERNAL_MEM_TYPE 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, FF_INTERNAL_MEM_TYPE size)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

libavformat/assdec.c:155:5: 
153.     end= strchr(p, '\n');
154.     av_new_packet(pkt, end ? end-p+1 : strlen(p));
155.     pkt->flags |= AV_PKT_FLAG_KEY;
         ^
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
157.     pkt->pts= pkt->dts= get_pts(p);

libavformat/assdec.c:156:5: 
154.     av_new_packet(pkt, end ? end-p+1 : strlen(p));
155.     pkt->flags |= AV_PKT_FLAG_KEY;
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
         ^
157.     pkt->pts= pkt->dts= get_pts(p);
158.     memcpy(pkt->data, p, pkt->size);

libavformat/assdec.c:157:5: 
155.     pkt->flags |= AV_PKT_FLAG_KEY;
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
157.     pkt->pts= pkt->dts= get_pts(p);
         ^
158.     memcpy(pkt->data, p, pkt->size);
159. 

libavformat/assdec.c:55:1: start of procedure get_pts()
  53. }
  54. 
  55. static int64_t get_pts(const uint8_t *p)
      ^
  56. {
  57.     int hour, min, sec, hsec;

libavformat/assdec.c:59:8: Taking false branch
  57.     int hour, min, sec, hsec;
  58. 
  59.     if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
             ^
  60.         return AV_NOPTS_VALUE;
  61. 

libavformat/assdec.c:64:5: 
  62. //    av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p);
  63. 
  64.     min+= 60*hour;
          ^
  65.     sec+= 60*min;
  66. 

libavformat/assdec.c:65:5: 
  63. 
  64.     min+= 60*hour;
  65.     sec+= 60*min;
          ^
  66. 
  67.     return sec*100+hsec;

libavformat/assdec.c:67:5: 
  65.     sec+= 60*min;
  66. 
  67.     return sec*100+hsec;
          ^
  68. }
  69. 

libavformat/assdec.c:68:1: return from a call to get_pts
  66. 
  67.     return sec*100+hsec;
  68. }
      ^
  69. 
  70. static int event_cmp(uint8_t **a, uint8_t **b)

libavformat/assdec.c:158:5: 
156.     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
157.     pkt->pts= pkt->dts= get_pts(p);
158.     memcpy(pkt->data, p, pkt->size);
         ^
159. 
160.     ass->event_index++;
