]> git.sesse.net Git - ffmpeg/commitdiff
avutil/softfloat: Fix exponent underflow in av_mul_sf()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Nov 2015 12:57:19 +0000 (13:57 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Nov 2015 13:23:38 +0000 (14:23 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/softfloat.h

index fcad0f00ccc6286e256778418cb3ab650848e89d..e47420e999f70383964bb1c803018c87a6b62a79 100644 (file)
@@ -98,7 +98,10 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
     a.exp += b.exp;
     av_assert2((int32_t)((a.mant * (int64_t)b.mant) >> ONE_BITS) == (a.mant * (int64_t)b.mant) >> ONE_BITS);
     a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS;
-    return av_normalize1_sf((SoftFloat){a.mant, a.exp - 1});
+    a = av_normalize1_sf((SoftFloat){a.mant, a.exp - 1});
+    if (!a.mant || a.exp < MIN_EXP)
+        return FLOAT_0;
+    return a;
 }
 
 /**