summaryrefslogtreecommitdiff
path: root/libavformat/oggparsetheora.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-09-20 01:33:47 +0200
committerLuca Barbato <lu_zero@gentoo.org>2012-09-24 22:35:29 +0200
commit0336dea2ef7e7136273170efbe0e8cb5de6815c0 (patch)
treed642c4a90b01ec6dea62a3f330656d23496d1d52 /libavformat/oggparsetheora.c
parentbb146bb57bea6647f9c080aa4f9323a3a789ad22 (diff)
oggparsetheora: make it more robust
Diffstat (limited to 'libavformat/oggparsetheora.c')
-rw-r--r--libavformat/oggparsetheora.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 632c4ef521..dfb73c9bd1 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -53,7 +53,8 @@ theora_header (AVFormatContext * s, int idx)
os->private = thp;
}
- if (os->buf[os->pstart] == 0x80) {
+ switch (os->buf[os->pstart]) {
+ case 0x80: {
GetBitContext gb;
int width, height;
AVRational timebase;
@@ -110,8 +111,16 @@ theora_header (AVFormatContext * s, int idx)
st->codec->codec_id = AV_CODEC_ID_THEORA;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
- } else if (os->buf[os->pstart] == 0x83) {
- ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
+ }
+ break;
+ case 0x81:
+ ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
+ case 0x82:
+ if (!thp->version)
+ return -1;
+ break;
+ default:
+ return -1;
}
st->codec->extradata = av_realloc (st->codec->extradata,