avformat/oggparsevorbis: Error out on double init of vp
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 19 Apr 2020 15:05:52 +0000 (17:05 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 25 May 2020 22:45:27 +0000 (00:45 +0200)
Fixes: memleak
Fixes: 19949/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5743636058210304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggparsevorbis.c

index 6f15204..246ba8f 100644 (file)
@@ -385,7 +385,12 @@ static int vorbis_header(AVFormatContext *s, int idx)
             }
         }
     } else {
-        int ret = fixup_vorbis_headers(s, priv, &st->codecpar->extradata);
+        int ret;
+
+        if (priv->vp)
+             return AVERROR_INVALIDDATA;
+
+        ret = fixup_vorbis_headers(s, priv, &st->codecpar->extradata);
         if (ret < 0) {
             st->codecpar->extradata_size = 0;
             return ret;