]> git.sesse.net Git - ffmpeg/commitdiff
matroskadec: Ensure time_scale is nonzero, fixes divide-by-zero if the file
authorDavid Conrad <lessen42@gmail.com>
Tue, 18 May 2010 21:21:28 +0000 (21:21 +0000)
committerDavid Conrad <lessen42@gmail.com>
Tue, 18 May 2010 21:21:28 +0000 (21:21 +0000)
has 0 written

Based on a Chromium patch

Originally committed as revision 23167 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskadec.c

index 556d6b9eb81dc85bfe2a5743f18d052c9e096da9..4d18d99e15e697b82340ed5276b8d89fba8fb7cd 100644 (file)
@@ -1154,6 +1154,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
         return -1;
     matroska_execute_seekhead(matroska);
 
+    if (!matroska->time_scale)
+        matroska->time_scale = 1000000;
     if (matroska->duration)
         matroska->ctx->duration = matroska->duration * matroska->time_scale
                                   * 1000 / AV_TIME_BASE;