[FFmpeg-cvslog] ogg: Always alloc the private context in vorbis_header

Luca Barbato git at videolan.org
Thu Sep 26 00:16:34 CEST 2013


ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Tue Aug 13 07:28:41 2013 +0200| [15620c153a35f76191c1e476fc9df24fbfd54e10] | committer: Sean McGovern

ogg: Always alloc the private context in vorbis_header

It is possible to have an initial broken header and then valid packets.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 3562684db716d11de0b0dcc52748e9cd90d68132)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15620c153a35f76191c1e476fc9df24fbfd54e10
---

 libavformat/oggparsevorbis.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 7ec7a9e..272e50c 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -208,15 +208,15 @@ vorbis_header (AVFormatContext * s, int idx)
     struct oggvorbis_private *priv;
     int pkt_type = os->buf[os->pstart];
 
-    if (!(pkt_type & 1))
-        return 0;
-
     if (!os->private) {
         os->private = av_mallocz(sizeof(struct oggvorbis_private));
         if (!os->private)
             return 0;
     }
 
+    if (!(pkt_type & 1))
+        return 0;
+
     if (os->psize < 1 || pkt_type > 5)
         return -1;
 



More information about the ffmpeg-cvslog mailing list