[FFmpeg-cvslog] av_d2q: Fix infinity check
Michael Niedermayer
git at videolan.org
Sat May 25 16:04:26 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May 25 15:22:19 2013 +0200| [de7d29063133b240a9fe2c26049b35a6a028c8a1] | committer: Michael Niedermayer
av_d2q: Fix infinity check
The old check would fail on huge but not infinite values
and the later code could then fail to handle them correctly in
some cases.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de7d29063133b240a9fe2c26049b35a6a028c8a1
---
libavutil/rational.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavutil/rational.c b/libavutil/rational.c
index e333f62..5b9b86f 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -110,7 +110,7 @@ AVRational av_d2q(double d, int max)
int64_t den;
if (isnan(d))
return (AVRational) { 0,0 };
- if (isinf(d))
+ if (fabs(d) > INT_MAX + 3LL)
return (AVRational) { d < 0 ? -1 : 1, 0 };
exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
den = 1LL << (61 - exponent);
More information about the ffmpeg-cvslog
mailing list