[FFmpeg-cvslog] oggparsetheora: make it more robust

Luca Barbato git at videolan.org
Tue Sep 25 16:15:39 CEST 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Sep 20 01:33:47 2012 +0200| [0336dea2ef7e7136273170efbe0e8cb5de6815c0] | committer: Luca Barbato

oggparsetheora: make it more robust

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

 libavformat/oggparsetheora.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 632c4ef..dfb73c9 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,



More information about the ffmpeg-cvslog mailing list