diff options
author | Måns Rullgård <mans@mansr.com> | 2005-05-12 22:33:05 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2005-05-12 22:33:05 +0000 |
commit | 5b558574bacb942a4ca78d4b33a86e6a2e9de972 (patch) | |
tree | 6dbad162b7e041f0604f2c70823458f6b1ad30f9 | |
parent | 5085d59ddc52c03db5aa50285f42cc4c4d6c5ad2 (diff) | |
download | ffmpeg-5b558574bacb942a4ca78d4b33a86e6a2e9de972.tar.gz |
check theora version
Originally committed as revision 4229 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/oggparsetheora.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 3ca5d91da8..8927822570 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -43,7 +43,7 @@ theora_header (AVFormatContext * s, int idx) int cds = st->codec.extradata_size + os->psize + 2; uint8_t *cdp; - if (os->seq > 2) + if(!(os->buf[os->pstart] & 0x80)) return 0; if(!thp){ @@ -56,8 +56,12 @@ theora_header (AVFormatContext * s, int idx) init_get_bits(&gb, os->buf + os->pstart, os->psize*8); skip_bits(&gb, 7*8); /* 0x80"theora" */ - skip_bits(&gb, 3*8); - + if(get_bits(&gb, 8) != 3) /* major version */ + return -1; + if(get_bits(&gb, 8) != 2) /* minor version */ + return -1; + skip_bits(&gb, 8); /* revision */ + st->codec.width = get_bits(&gb, 16) << 4; st->codec.height = get_bits(&gb, 16) << 4; @@ -86,8 +90,7 @@ theora_header (AVFormatContext * s, int idx) memcpy (cdp, os->buf + os->pstart, os->psize); st->codec.extradata_size = cds; - - return os->seq < 3; + return 1; } static uint64_t |