[Ffmpeg-cvslog] r7186 - trunk/libavutil/rational.c

Uoti Urpala uoti.urpala
Thu Nov 30 11:01:22 CET 2006


On Thu, 2006-11-30 at 02:18 +0100, michael wrote:
> +            // Won't overflow, sum == original denominator
> +            if (den*(2*x*a1.den + a0.den) > nom*a1.den)

After your changes to the patch this comment is no longer true, and it
DOES overflow. For example with
original fraction = 2000000000000000000 / 6283185306000000001
limit = 100000
the multiplication overflows and the function incorrectly returns
113/355 instead of 31746/99733.

Since the increase is at most 2x you can still write the terms this way
if you prefer by casting to unsigned. The comment would still be
misleading though; the compared terms no longer add to the original
denominator.





More information about the ffmpeg-cvslog mailing list