diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-25 15:22:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-25 16:03:50 +0200 |
commit | de7d29063133b240a9fe2c26049b35a6a028c8a1 (patch) | |
tree | 946aba0942dfc943f9925bf09d95c6d80150d438 /libavutil | |
parent | 8caf2da320527107b12a54c0cda5f8b5cf0117cd (diff) | |
download | ffmpeg-de7d29063133b240a9fe2c26049b35a6a028c8a1.tar.gz |
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@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/rational.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c index e333f620f9..5b9b86fb6d 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); |