[libmath-prime-util-perl] 20/25: Protect against overflow

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:50:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.35
in repository libmath-prime-util-perl.

commit 1b6c179b1e558c1c6e9b3731665c22050cfabeb0
Author: Dana Jacobsen <dana at acm.org>
Date:   Fri Dec 6 18:15:25 2013 -0800

    Protect against overflow
---
 lehmer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lehmer.c b/lehmer.c
index 4e6488f..169d931 100644
--- a/lehmer.c
+++ b/lehmer.c
@@ -280,7 +280,7 @@ static UV bs_prime_count(uint32_t n, uint32_t const* const primes, uint32_t last
     if (j > (n>>4)) j = n>>4;
   }
   while (i < j) {
-    UV mid = (i+j)/2;
+    UV mid = i + (j-i)/2;
     if (primes[mid] <= n)  i = mid+1;
     else                   j = mid;
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list