libavformat/oggparsevorbis: Fix memleak on multiple headers
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 6 Mar 2018 17:14:12 +0000 (18:14 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 7 Mar 2018 19:37:33 +0000 (20:37 +0100)
Fixes: Chromium bug 800123
Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggparsevorbis.c

index 29b1ab5..bcfd246 100644 (file)
@@ -230,6 +230,10 @@ static int fixup_vorbis_headers(AVFormatContext *as,
 
     len = priv->len[0] + priv->len[1] + priv->len[2];
     buf_len = len + len / 255 + 64;
+
+    if (*buf)
+        return AVERROR_INVALIDDATA;
+
     ptr = *buf = av_realloc(NULL, buf_len);
     if (!ptr)
         return AVERROR(ENOMEM);