diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-08-13 07:28:41 +0200 |
---|---|---|
committer | Sean McGovern <gseanmcg@gmail.com> | 2013-09-23 19:41:09 -0400 |
commit | 15620c153a35f76191c1e476fc9df24fbfd54e10 (patch) | |
tree | 490021ea02cdc0bdab5432953af9d382ffa5534d | |
parent | 75b1b13aff73bbe78a4da756dd4c048dd3462cb0 (diff) | |
download | ffmpeg-15620c153a35f76191c1e476fc9df24fbfd54e10.tar.gz |
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@libav.org
(cherry picked from commit 3562684db716d11de0b0dcc52748e9cd90d68132)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavformat/oggparsevorbis.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 7ec7a9eaeb..272e50c9bb 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; |