libavformat/oggparsespeex.c:80: error: Null Dereference
  pointer `st->codecpar->extradata` last assigned on line 78 could be null and is dereferenced by call to `memcpy()` at line 80, column 9.

libavformat/oggparsespeex.c:41:1: start of procedure speex_header()
39. };
40. 
41. static int speex_header(AVFormatContext *s, int idx) {
    ^
42.     struct ogg *ogg = s->priv_data;
43.     struct ogg_stream *os = ogg->streams + idx;

libavformat/oggparsespeex.c:42:5: 
40. 
41. static int speex_header(AVFormatContext *s, int idx) {
42.     struct ogg *ogg = s->priv_data;
        ^
43.     struct ogg_stream *os = ogg->streams + idx;
44.     struct speex_params *spxp = os->private;

libavformat/oggparsespeex.c:43:5: 
41. static int speex_header(AVFormatContext *s, int idx) {
42.     struct ogg *ogg = s->priv_data;
43.     struct ogg_stream *os = ogg->streams + idx;
        ^
44.     struct speex_params *spxp = os->private;
45.     AVStream *st = s->streams[idx];

libavformat/oggparsespeex.c:44:5: 
42.     struct ogg *ogg = s->priv_data;
43.     struct ogg_stream *os = ogg->streams + idx;
44.     struct speex_params *spxp = os->private;
        ^
45.     AVStream *st = s->streams[idx];
46.     uint8_t *p = os->buf + os->pstart;

libavformat/oggparsespeex.c:45:5: 
43.     struct ogg_stream *os = ogg->streams + idx;
44.     struct speex_params *spxp = os->private;
45.     AVStream *st = s->streams[idx];
        ^
46.     uint8_t *p = os->buf + os->pstart;
47. 

libavformat/oggparsespeex.c:46:5: 
44.     struct speex_params *spxp = os->private;
45.     AVStream *st = s->streams[idx];
46.     uint8_t *p = os->buf + os->pstart;
        ^
47. 
48.     if (!spxp) {

libavformat/oggparsespeex.c:48:10: Taking false branch
46.     uint8_t *p = os->buf + os->pstart;
47. 
48.     if (!spxp) {
             ^
49.         spxp = av_mallocz(sizeof(*spxp));
50.         if (!spxp)

libavformat/oggparsespeex.c:55:9: Taking false branch
53.     }
54. 
55.     if (spxp->seq > 1)
            ^
56.         return 0;
57. 

libavformat/oggparsespeex.c:58:9: Taking true branch
56.         return 0;
57. 
58.     if (spxp->seq == 0) {
            ^
59.         int frames_per_packet;
60.         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;

libavformat/oggparsespeex.c:60:9: 
58.     if (spxp->seq == 0) {
59.         int frames_per_packet;
60.         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
            ^
61.         st->codecpar->codec_id = AV_CODEC_ID_SPEEX;
62. 

libavformat/oggparsespeex.c:61:9: 
59.         int frames_per_packet;
60.         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
61.         st->codecpar->codec_id = AV_CODEC_ID_SPEEX;
            ^
62. 
63.         st->codecpar->sample_rate = AV_RL32(p + 36);

libavformat/oggparsespeex.c:63:9: 
61.         st->codecpar->codec_id = AV_CODEC_ID_SPEEX;
62. 
63.         st->codecpar->sample_rate = AV_RL32(p + 36);
            ^
64.         st->codecpar->channels = AV_RL32(p + 48);
65.         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {

libavformat/oggparsespeex.c:64:9: 
62. 
63.         st->codecpar->sample_rate = AV_RL32(p + 36);
64.         st->codecpar->channels = AV_RL32(p + 48);
            ^
65.         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
66.             av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");

libavformat/oggparsespeex.c:65:13: Taking false branch
63.         st->codecpar->sample_rate = AV_RL32(p + 36);
64.         st->codecpar->channels = AV_RL32(p + 48);
65.         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
                ^
66.             av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");
67.             return AVERROR_INVALIDDATA;

libavformat/oggparsespeex.c:65:43: Taking false branch
63.         st->codecpar->sample_rate = AV_RL32(p + 36);
64.         st->codecpar->channels = AV_RL32(p + 48);
65.         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
                                              ^
66.             av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");
67.             return AVERROR_INVALIDDATA;

libavformat/oggparsespeex.c:69:40: Condition is false
67.             return AVERROR_INVALIDDATA;
68.         }
69.         st->codecpar->channel_layout = st->codecpar->channels == 1 ? AV_CH_LAYOUT_MONO :
                                           ^
70.                                                                      AV_CH_LAYOUT_STEREO;
71. 

libavformat/oggparsespeex.c:69:9: 
67.             return AVERROR_INVALIDDATA;
68.         }
69.         st->codecpar->channel_layout = st->codecpar->channels == 1 ? AV_CH_LAYOUT_MONO :
            ^
70.                                                                      AV_CH_LAYOUT_STEREO;
71. 

libavformat/oggparsespeex.c:72:9: 
70.                                                                      AV_CH_LAYOUT_STEREO;
71. 
72.         spxp->packet_size  = AV_RL32(p + 56);
            ^
73.         frames_per_packet  = AV_RL32(p + 64);
74.         if (frames_per_packet)

libavformat/oggparsespeex.c:73:9: 
71. 
72.         spxp->packet_size  = AV_RL32(p + 56);
73.         frames_per_packet  = AV_RL32(p + 64);
            ^
74.         if (frames_per_packet)
75.             spxp->packet_size *= frames_per_packet;

libavformat/oggparsespeex.c:74:13: Taking true branch
72.         spxp->packet_size  = AV_RL32(p + 56);
73.         frames_per_packet  = AV_RL32(p + 64);
74.         if (frames_per_packet)
                ^
75.             spxp->packet_size *= frames_per_packet;
76. 

libavformat/oggparsespeex.c:75:13: 
73.         frames_per_packet  = AV_RL32(p + 64);
74.         if (frames_per_packet)
75.             spxp->packet_size *= frames_per_packet;
                ^
76. 
77.         st->codecpar->extradata_size = os->psize;

libavformat/oggparsespeex.c:77:9: 
75.             spxp->packet_size *= frames_per_packet;
76. 
77.         st->codecpar->extradata_size = os->psize;
            ^
78.         st->codecpar->extradata = av_malloc(st->codecpar->extradata_size
79.                                             + AV_INPUT_BUFFER_PADDING_SIZE);

libavformat/oggparsespeex.c:78:9: 
76. 
77.         st->codecpar->extradata_size = os->psize;
78.         st->codecpar->extradata = av_malloc(st->codecpar->extradata_size
            ^
79.                                             + AV_INPUT_BUFFER_PADDING_SIZE);
80.         memcpy(st->codecpar->extradata, p, st->codecpar->extradata_size);

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

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

libavutil/mem.c:70:9: Taking true branch
  68. 
  69.     /* let's disallow possibly ambiguous cases */
  70.     if (size > (INT_MAX - 32) || !size)
              ^
  71.         return NULL;
  72. 

libavutil/mem.c:71:9: 
  69.     /* let's disallow possibly ambiguous cases */
  70.     if (size > (INT_MAX - 32) || !size)
  71.         return NULL;
              ^
  72. 
  73. #if CONFIG_MEMALIGN_HACK

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

libavformat/oggparsespeex.c:80:9: 
78.         st->codecpar->extradata = av_malloc(st->codecpar->extradata_size
79.                                             + AV_INPUT_BUFFER_PADDING_SIZE);
80.         memcpy(st->codecpar->extradata, p, st->codecpar->extradata_size);
            ^
81. 
82.         avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
