[FFmpeg-devel] [PATCH 01/12] Make av_d2q() manage the case where d is infinite.
Michael Niedermayer
michaelni
Fri Oct 1 20:36:10 CEST 2010
On Fri, Oct 01, 2010 at 06:08:49PM +0200, Stefano Sabatini wrote:
> ---
> libavutil/rational.c | 2 ++
> libavutil/rational.h | 2 ++
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/libavutil/rational.c b/libavutil/rational.c
> index 0e0571e..b5af28e 100644
> --- a/libavutil/rational.c
> +++ b/libavutil/rational.c
> @@ -98,6 +98,8 @@ AVRational av_d2q(double d, int max){
> #define LOG2 0.69314718055994530941723212145817656807550013436025
> int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
> int64_t den= 1LL << (61 - exponent);
> + if (isinf(d))
> + return (AVRational){1,0};
if iam not mistaken then the int cast above has undefined behavior in this case
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101001/f6256526/attachment.pgp>
More information about the ffmpeg-devel
mailing list