Coverity: Division by zero: CID 400004
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 29 Feb 2012 19:53:52 +0000 (14:53 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 29 Feb 2012 19:53:52 +0000 (14:53 -0500)
* src/media/media.c (Fmedia_stream_aspect): assert for den != 0,
with additional check for the "already crashing" scenario.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/media/media.c

index a6668cf..1f0b96d 100644 (file)
@@ -1103,7 +1103,9 @@ the second element to the second one and so on.
                }
 
                if (LIKELY(NILP(quotientp))) {
-                       tmp = make_float((fpfloat)num / (fpfloat)den);
+                       assert(den != 0);
+                       if( den != 0)
+                               tmp = make_float((fpfloat)num / (fpfloat)den);
                }
 #if defined HAVE_MPQ && defined WITH_GMP
                else {