Commit f3866a14 authored by Andreas Cadhalpun's avatar 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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 6a11c7f1
...@@ -174,6 +174,8 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val) ...@@ -174,6 +174,8 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
if (val.mant == 0) if (val.mant == 0)
val.exp = MIN_EXP; val.exp = MIN_EXP;
else if (val.mant < 0)
av_assert0(0);
else else
{ {
tabIndex = (val.mant - 0x20000000) >> 20; tabIndex = (val.mant - 0x20000000) >> 20;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment