avformat/mov: Do not set aspect ratios that would contain zeros
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Jan 2015 03:26:16 +0000 (04:26 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Jan 2015 03:26:16 +0000 (04:26 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index 3da296bd072b7cace078acc9612939943e2e102a..556411f1ef9f12097a5f779e858e815c26dc92e6 100644 (file)
@@ -2874,7 +2874,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         for (i = 0; i < 2; i++)
             disp_transform[i] = sqrt(SQR(display_matrix[i][0]) + SQR(display_matrix[i][1]));
 
-        if (fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
+        if (disp_transform[0] > 0 && disp_transform[1] > 0 &&
+            fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
             st->sample_aspect_ratio = av_d2q(
                 disp_transform[0] / disp_transform[1],
                 INT_MAX);