changeset 4642:60d5f0997351 libavformat

MOV: fix crash when 'meta' occurs before first 'trak'
author alexc
date Tue, 03 Mar 2009 18:19:44 +0000
parents aa5dcae3f210
children d148dbaebaca
files mov.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mov.c	Tue Mar 03 17:06:18 2009 +0000
+++ b/mov.c	Tue Mar 03 18:19:44 2009 +0000
@@ -308,10 +308,15 @@
 
 static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
-    AVStream *st = c->fc->streams[c->fc->nb_streams-1];
+    AVStream *st;
     uint32_t type;
     uint32_t ctype;
 
+    if (c->fc->nb_streams < 1) // meta before first trak
+        return 0;
+
+    st = c->fc->streams[c->fc->nb_streams-1];
+
     get_byte(pb); /* version */
     get_be24(pb); /* flags */