[FFmpeg-devel] [PATCH]Don't try to read total track number if data atom is too short

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Nov 17 01:10:51 CET 2011


Hi!

Attached patch fixes ticket #659 for me.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 668ff89..e940427 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -87,10 +87,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


More information about the ffmpeg-devel mailing list