[FFmpeg-devel] [PATCH 3/4] softfloat: fix av_add_sf if one argument is zero
Michael Niedermayer
michael at niedermayer.cc
Sun Nov 8 00:54:00 CET 2015
On Sun, Nov 08, 2015 at 12:08:54AM +0100, Andreas Cadhalpun wrote:
> 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.Cadhalpun at 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;
this looks strange
0 should probably have the minimum exponent not 33
now if you want to support denormalized numbers, that is ones that
have exponents larger than needed then this patch is not sufficient
the same problem would arrise with non 0 mantisses too if their
exponents arent minimal
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151108/a5f5bda0/attachment.sig>
More information about the ffmpeg-devel
mailing list