mov: do not try to read total disc/track number if data atom is too short.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 17 Nov 2011 13:12:34 +0000 (14:12 +0100)
committerAnton Khirnov <anton@khirnov.net>
Tue, 26 Jun 2012 11:12:50 +0000 (13:12 +0200)
Fixes bug 308.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/mov.c

index fa70eff..6325401 100644 (file)
@@ -71,10 +71,11 @@ static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
 {
     char buf[16];
 
-    short current, total;
+    short current, total = 0;
     avio_rb16(pb); // unknown
     current = avio_rb16(pb);
-    total = avio_rb16(pb);
+    if (len >= 6)
+        total = avio_rb16(pb);
     if (!total)
         snprintf(buf, sizeof(buf), "%d", current);
     else