On Sun, Nov 08, 2015 at 12:09:02AM +0100, Andreas Cadhalpun wrote: > Mathematically this is bogus, but it is much better than the previous > behaviour: returning a random value from an out of bounds read. > > Returning zero will just lead to division by zero problems. > > This fixes av_assert2 failures in the aac_fixed decoder. > > Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> > --- > libavutil/softfloat.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h > index fefde8c..0a2074a 100644 > --- a/libavutil/softfloat.h > +++ b/libavutil/softfloat.h > @@ -170,6 +170,8 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat > val) > > if (val.mant == 0) > val.exp = 0; > + else if (val.mant < 0) > + val = FLOAT_1;
this is IMHO not ok sqrt(-1) has 3 sane possible outcomes 1. the complex number i 2. NaN 3. abort() like division by 0 sqare roots of negative numbers in a context of real values are a bug, there is likely something wrong in the code that is calling sqrt with a negative number and simply returning 1 silently would make it hard to find and debug such bugs [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel