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

libavformat/oggparsevorbis.c:154:1: start of procedure vorbis_header()
152. 
153. 
154. static int
     ^
155. vorbis_header (AVFormatContext * s, int idx)
156. {

libavformat/oggparsevorbis.c:157:5: 
155. vorbis_header (AVFormatContext * s, int idx)
156. {
157.     ogg_t *ogg = s->priv_data;
         ^
158.     ogg_stream_t *os = ogg->streams + idx;
159.     AVStream *st = s->streams[idx];

libavformat/oggparsevorbis.c:158:5: 
156. {
157.     ogg_t *ogg = s->priv_data;
158.     ogg_stream_t *os = ogg->streams + idx;
         ^
159.     AVStream *st = s->streams[idx];
160.     oggvorbis_private_t *priv;

libavformat/oggparsevorbis.c:159:5: 
157.     ogg_t *ogg = s->priv_data;
158.     ogg_stream_t *os = ogg->streams + idx;
159.     AVStream *st = s->streams[idx];
         ^
160.     oggvorbis_private_t *priv;
161. 

libavformat/oggparsevorbis.c:162:9: Taking false branch
160.     oggvorbis_private_t *priv;
161. 
162.     if (os->seq > 2)
             ^
163.         return 0;
164. 

libavformat/oggparsevorbis.c:165:9: Taking false branch
163.         return 0;
164. 
165.     if (os->seq == 0) {
             ^
166.         os->private = av_mallocz(sizeof(oggvorbis_private_t));
167.         if (!os->private)

libavformat/oggparsevorbis.c:171:9: Taking false branch
169.     }
170. 
171.     if (os->psize < 1)
             ^
172.         return -1;
173. 

libavformat/oggparsevorbis.c:174:5: 
172.         return -1;
173. 
174.     priv = os->private;
         ^
175.     priv->len[os->seq] = os->psize;
176.     priv->packet[os->seq] = av_mallocz(os->psize);

libavformat/oggparsevorbis.c:175:5: 
173. 
174.     priv = os->private;
175.     priv->len[os->seq] = os->psize;
         ^
176.     priv->packet[os->seq] = av_mallocz(os->psize);
177.     memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);

libavformat/oggparsevorbis.c:176:5: 
174.     priv = os->private;
175.     priv->len[os->seq] = os->psize;
176.     priv->packet[os->seq] = av_mallocz(os->psize);
         ^
177.     memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize);
178.     if (os->buf[os->pstart] == 1) {

libavutil/mem.c:132:1: start of procedure av_mallocz()
  130. }
  131. 
  132. void *av_mallocz(unsigned int size)
       ^
  133. {
  134.     void *ptr = av_malloc(size);

libavutil/mem.c:134:5: 
  132. void *av_mallocz(unsigned int size)
  133. {
  134.     void *ptr = av_malloc(size);
           ^
  135.     if (ptr)
  136.         memset(ptr, 0, size);

libavutil/mem.c:42:1: start of procedure av_malloc()
    40.    linker will do it automatically */
    41. 
    42. void *av_malloc(unsigned int size)
        ^
    43. {
    44.     void *ptr;

libavutil/mem.c:50:8: Taking false branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
    59.     ((char*)ptr)[-1]= diff;
    60. #elif defined (HAVE_MEMALIGN)
    61.     ptr = memalign(16,size);
            ^
    62.     /* Why 64?
    63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
    89.     ptr = malloc(size);
    90. #endif
    91.     return ptr;
            ^
    92. }
    93. 

libavutil/mem.c:92:1: return from a call to av_malloc
    90. #endif
    91.     return ptr;
    92. }
        ^
    93. 
    94. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:135:9: Taking false branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:137:5: 
  135.     if (ptr)
  136.         memset(ptr, 0, size);
  137.     return ptr;
           ^
  138. }
  139. 

libavutil/mem.c:138:1: return from a call to av_mallocz
  136.         memset(ptr, 0, size);
  137.     return ptr;
  138. }
       ^
  139. 
  140. char *av_strdup(const char *s)

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

static int
vorbis_header (AVFormatContext * s, int idx)
{
    ogg_t *ogg = s->priv_data;
    ogg_stream_t *os = ogg->streams + idx;
    AVStream *st = s->streams[idx];
    oggvorbis_private_t *priv;
    if (os->seq > 2)
        return 0;
    if (os->seq == 0) {
        os->private = av_mallocz(sizeof(oggvorbis_private_t));
        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    ogg_t *ogg = s->priv_data;\n    ogg_stream_t *os = ogg->streams + idx;\n    AVStream *st = s->streams[idx];\n    oggvorbis_private_t *priv;\n    if (os->seq > 2)\n        return 0;\n    if (os->seq == 0) {\n        os->private = av_mallocz(sizeof(oggvorbis_private_t));\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;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef 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 defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']