libavformat/oggparsevorbis.c:187: error: Null Dereference
  pointer `priv->packet[os->seq]` last assigned on line 186 could be null and is dereferenced by call to `memcpy()` at line 187, column 5.

libavformat/oggparsevorbis.c:164:1: start of procedure vorbis_header()
162. 
163. 
164. static int
     ^
165. vorbis_header (AVFormatContext * s, int idx)
166. {

libavformat/oggparsevorbis.c:167:5: 
165. vorbis_header (AVFormatContext * s, int idx)
166. {
167.     struct ogg *ogg = s->priv_data;
         ^
168.     struct ogg_stream *os = ogg->streams + idx;
169.     AVStream *st = s->streams[idx];

libavformat/oggparsevorbis.c:168:5: 
166. {
167.     struct ogg *ogg = s->priv_data;
168.     struct ogg_stream *os = ogg->streams + idx;
         ^
169.     AVStream *st = s->streams[idx];
170.     struct oggvorbis_private *priv;

libavformat/oggparsevorbis.c:169:5: 
167.     struct ogg *ogg = s->priv_data;
168.     struct ogg_stream *os = ogg->streams + idx;
169.     AVStream *st = s->streams[idx];
         ^
170.     struct oggvorbis_private *priv;
171. 

libavformat/oggparsevorbis.c:172:9: Taking false branch
170.     struct oggvorbis_private *priv;
171. 
172.     if (os->seq > 2)
             ^
173.         return 0;
174. 

libavformat/oggparsevorbis.c:175:9: Taking false branch
173.         return 0;
174. 
175.     if (os->seq == 0) {
             ^
176.         os->private = av_mallocz(sizeof(struct oggvorbis_private));
177.         if (!os->private)

libavformat/oggparsevorbis.c:181:9: Taking false branch
179.     }
180. 
181.     if (os->psize < 1)
             ^
182.         return -1;
183. 

libavformat/oggparsevorbis.c:184:5: 
182.         return -1;
183. 
184.     priv = os->private;
         ^
185.     priv->len[os->seq] = os->psize;
186.     priv->packet[os->seq] = av_mallocz(os->psize);

libavformat/oggparsevorbis.c:185:5: 
183. 
184.     priv = os->private;
185.     priv->len[os->seq] = os->psize;
         ^
186.     priv->packet[os->seq] = av_mallocz(os->psize);
187.     memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);

libavformat/oggparsevorbis.c:186:5: 
184.     priv = os->private;
185.     priv->len[os->seq] = os->psize;
186.     priv->packet[os->seq] = av_mallocz(os->psize);
         ^
187.     memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);
188.     if (os->buf[os->pstart] == 1) {

libavutil/mem.c:140:1: start of procedure av_mallocz()
  138. }
  139. 
  140. void *av_mallocz(unsigned int size)
       ^
  141. {
  142.     void *ptr = av_malloc(size);

libavutil/mem.c:142:5: 
  140. void *av_mallocz(unsigned int size)
  141. {
  142.     void *ptr = av_malloc(size);
           ^
  143.     if (ptr)
  144.         memset(ptr, 0, size);

libavutil/mem.c:47:1: start of procedure av_malloc()
    45.    linker will do it automatically. */
    46. 
    47. void *av_malloc(unsigned int size)
        ^
    48. {
    49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
    47. void *av_malloc(unsigned int size)
    48. {
    49.     void *ptr = NULL;
            ^
    50. #if CONFIG_MEMALIGN_HACK
    51.     long diff;

libavutil/mem.c:55:8: Taking true branch
    53. 
    54.     /* let's disallow possible ambiguous cases */
    55.     if(size > (INT_MAX-16) )
               ^
    56.         return NULL;
    57. 

libavutil/mem.c:56:9: 
    54.     /* let's disallow possible ambiguous cases */
    55.     if(size > (INT_MAX-16) )
    56.         return NULL;
                ^
    57. 
    58. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:100:1: return from a call to av_malloc
     98. #endif
     99.     return ptr;
    100. }
         ^
    101. 
    102. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:143:9: Taking false branch
  141. {
  142.     void *ptr = av_malloc(size);
  143.     if (ptr)
               ^
  144.         memset(ptr, 0, size);
  145.     return ptr;

libavutil/mem.c:145:5: 
  143.     if (ptr)
  144.         memset(ptr, 0, size);
  145.     return ptr;
           ^
  146. }
  147. 

libavutil/mem.c:146:1: return from a call to av_mallocz
  144.         memset(ptr, 0, size);
  145.     return ptr;
  146. }
       ^
  147. 
  148. char *av_strdup(const char *s)

libavformat/oggparsevorbis.c:187:5: 
185.     priv->len[os->seq] = os->psize;
186.     priv->packet[os->seq] = av_mallocz(os->psize);
187.     memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);
         ^
188.     if (os->buf[os->pstart] == 1) {
189.         const uint8_t *p = os->buf + os->pstart + 7; /* skip "\001vorbis" tag */

static int
vorbis_header (AVFormatContext * s, int idx)
{
    struct ogg *ogg = s->priv_data;
    struct ogg_stream *os = ogg->streams + idx;
    AVStream *st = s->streams[idx];
    struct oggvorbis_private *priv;
    if (os->seq > 2)
        return 0;
    if (os->seq == 0) {
        os->private = av_mallocz(sizeof(struct oggvorbis_private));
        if (!os->private)
            return 0;
    }
    if (os->psize < 1)
        return -1;
    priv = os->private;
    priv->len[os->seq] = os->psize;
    priv->packet[os->seq] = av_mallocz(os->psize);
    memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);
    if (os->buf[os->pstart] == 1) {
        const uint8_t *p = os->buf + os->pstart + 7;
        unsigned blocksize, bs0, bs1;
        if (os->psize != 30)
            return -1;
        if (bytestream_get_le32(&p) != 0)
            return -1;
        st->codec->channels = bytestream_get_byte(&p);
        st->codec->sample_rate = bytestream_get_le32(&p);
        p += 4;
        st->codec->bit_rate = bytestream_get_le32(&p);
        p += 4;
        blocksize = bytestream_get_byte(&p);
        bs0 = blocksize & 15;
        bs1 = blocksize >> 4;
        if (bs0 > bs1)
            return -1;
        if (bs0 < 6 || bs1 > 13)
            return -1;
        if (bytestream_get_byte(&p) != 1)
            return -1;
        st->codec->codec_type = CODEC_TYPE_AUDIO;
        st->codec->codec_id = CODEC_ID_VORBIS;
        st->time_base.num = 1;
        st->time_base.den = st->codec->sample_rate;
    } else if (os->buf[os->pstart] == 3) {
        if (os->psize > 8)
            vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);
    } else {
        st->codec->extradata_size =
            fixup_vorbis_headers(s, priv, &st->codec->extradata);
    }
    return os->seq < 3;
}
['static int\nvorbis_header (AVFormatContext * s, int idx)\n{\n    struct ogg *ogg = s->priv_data;\n    struct ogg_stream *os = ogg->streams + idx;\n    AVStream *st = s->streams[idx];\n    struct oggvorbis_private *priv;\n    if (os->seq > 2)\n        return 0;\n    if (os->seq == 0) {\n        os->private = av_mallocz(sizeof(struct oggvorbis_private));\n        if (!os->private)\n            return 0;\n    }\n    if (os->psize < 1)\n        return -1;\n    priv = os->private;\n    priv->len[os->seq] = os->psize;\n    priv->packet[os->seq] = av_mallocz(os->psize);\n    memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);\n    if (os->buf[os->pstart] == 1) {\n        const uint8_t *p = os->buf + os->pstart + 7;\n        unsigned blocksize, bs0, bs1;\n        if (os->psize != 30)\n            return -1;\n        if (bytestream_get_le32(&p) != 0)\n            return -1;\n        st->codec->channels = bytestream_get_byte(&p);\n        st->codec->sample_rate = bytestream_get_le32(&p);\n        p += 4;\n        st->codec->bit_rate = bytestream_get_le32(&p);\n        p += 4;\n        blocksize = bytestream_get_byte(&p);\n        bs0 = blocksize & 15;\n        bs1 = blocksize >> 4;\n        if (bs0 > bs1)\n            return -1;\n        if (bs0 < 6 || bs1 > 13)\n            return -1;\n        if (bytestream_get_byte(&p) != 1)\n            return -1;\n        st->codec->codec_type = CODEC_TYPE_AUDIO;\n        st->codec->codec_id = CODEC_ID_VORBIS;\n        st->time_base.num = 1;\n        st->time_base.den = st->codec->sample_rate;\n    } else if (os->buf[os->pstart] == 3) {\n        if (os->psize > 8)\n            vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);\n    } else {\n        st->codec->extradata_size =\n            fixup_vorbis_headers(s, priv, &st->codec->extradata);\n    }\n    return os->seq < 3;\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']