aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-08 13:57:19 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-11 23:32:51 +0100
commit402c4a9f81de2c2329b6de4a0fb991253e098cbc (patch)
tree50c0bb8f9eee29ad39d969f8567076ddf50513a1
parent6e4bfbe936179f1ca0f1f7c812f4bc8b817e487e (diff)
downloadffmpeg-402c4a9f81de2c2329b6de4a0fb991253e098cbc.tar.gz
avutil/softfloat: Fix exponent underflow in av_mul_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a1e3303fc01b95623d7a6963686c81b076690efd) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavutil/softfloat.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index fcad0f00cc..e47420e999 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;
}
/**