Otherwise (0x20000000, 1) + (0, 33) gives (0, 33), i.e. 1 + 0 = 0.

This fixes a division by zero in the aac_fixed decoder.

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavutil/softfloat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index e87cbf4..fefde8c 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -130,7 +130,9 @@ static inline av_const int av_gt_sf(SoftFloat a, SoftFloat 
b)
 
 static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
     int t= a.exp - b.exp;
-    if      (t <-31) return b;
+    if      (a.mant == 0) return b;
+    else if (b.mant == 0) return a;
+    else if (t <-31) return b;
     else if (t <  0) return av_normalize_sf(av_normalize1_sf((SoftFloat){ 
b.mant + (a.mant >> (-t)), b.exp}));
     else if (t < 32) return av_normalize_sf(av_normalize1_sf((SoftFloat){ 
a.mant + (b.mant >>   t ), a.exp}));
     else             return a;
-- 
2.6.2


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to