summaryrefslogtreecommitdiffstats
path: root/libavutil/softfloat.h
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-08 15:15:24 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-08 21:05:21 +0100
commitf3866a14c3c2949fad16267e9f2977ba9d7b5504 (patch)
treebd14cdc62ff51eab4b5fda684e2564e5210cb553 /libavutil/softfloat.h
parent6a11c7f1605d6f751fd9adb86f24f6c37bed5ddf (diff)
downloadffmpeg-streaming-f3866a14c3c2949fad16267e9f2977ba9d7b5504.zip
ffmpeg-streaming-f3866a14c3c2949fad16267e9f2977ba9d7b5504.tar.gz
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@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavutil/softfloat.h')
-rw-r--r--libavutil/softfloat.h2
1 files changed, 2 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud