avutil/softfloat: Check for MIN_EXP in av_sqrt_sf()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Nov 2015 12:25:54 +0000 (13:25 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Nov 2015 12:39:06 +0000 (13:39 +0100)
Otherwise the exponent could eventually underflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/softfloat.h

index 5335669..023ccd0 100644 (file)
@@ -181,6 +181,10 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
             val.mant >>= 1;
 
         val.exp = (val.exp >> 1) + 1;
+        if (val.exp < MIN_EXP) {
+            val.exp = MIN_EXP;
+            val.mant= 0;
+        }
     }
 
     return val;