[FFmpeg-cvslog] avutil/softfloat: Fix exponent underflow in av_mul_sf()

Michael Niedermayer git at videolan.org
Sun Nov 8 14:29:26 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Nov  8 13:57:19 2015 +0100| [a1e3303fc01b95623d7a6963686c81b076690efd] | committer: Michael Niedermayer

avutil/softfloat: Fix exponent underflow in av_mul_sf()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1e3303fc01b95623d7a6963686c81b076690efd
---

 libavutil/softfloat.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index fcad0f0..e47420e 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -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;
 }
 
 /**



More information about the ffmpeg-cvslog mailing list