[FFmpeg-cvslog] softfloat: assert when the argument of av_sqrt_sf is negative

Andreas Cadhalpun git at videolan.org
Sun Nov 8 21:10:08 CET 2015


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Nov  8 15:15:24 2015 +0100| [f3866a14c3c2949fad16267e9f2977ba9d7b5504] | committer: Andreas Cadhalpun

softfloat: assert when the argument of av_sqrt_sf is negative

The correct result can't be expressed in SoftFloat.
Currently it returns a random value from an out of bounds read.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavutil/softfloat.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 651bbf4..4cc3ceb 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -174,6 +174,8 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
 
     if (val.mant == 0)
         val.exp = MIN_EXP;
+    else if (val.mant < 0)
+        av_assert0(0);
     else
     {
         tabIndex = (val.mant - 0x20000000) >> 20;



More information about the ffmpeg-cvslog mailing list