[libmath-prime-util-perl] 107/181: Another case of RT71548
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:51:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.36
in repository libmath-prime-util-perl.
commit 068ad544612956852ec9efc10052a462a3146992
Author: Dana Jacobsen <dana at acm.org>
Date: Fri Jan 3 03:17:40 2014 -0800
Another case of RT71548
---
lib/Math/Prime/Util.pm | 2 ++
lib/Math/Prime/Util/PP.pm | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 2a6642a..41a706b 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1014,6 +1014,8 @@ sub primes {
sub random_maurer_prime_with_cert {
my($k) = @_;
_validate_num($k, 2) || _validate_positive_integer($k, 2);
+ # This should never happen. Trap now to prevent infinite loop.
+ croak "number of bits must not be a bigint" if ref($k) eq 'Math::BigInt';
# Results for random_nbit_prime are proven for all native bit sizes.
my $p0 = MPU_MAXBITS;
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 169c8a3..b1b8894 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -92,12 +92,12 @@ sub _validate_positive_integer {
croak "Parameter '$n' must be a positive integer"
if $n->sign() ne '+' || !$n->is_int();
$_[0] = _bigint_to_int($_[0])
- if $n <= (OLD_PERL_VERSION ? 562949953421312 : ~0);
+ if $n <= (OLD_PERL_VERSION ? 562949953421312 : ''.~0);
} else {
my $strn = "$n";
croak "Parameter '$strn' must be a positive integer"
if $strn =~ tr/0123456789//c && $strn !~ /^\+?\d+$/;
- if ($n <= (OLD_PERL_VERSION ? 562949953421312 : ~0)) {
+ if ($n <= (OLD_PERL_VERSION ? 562949953421312 : ''.~0)) {
$_[0] = $strn if ref($n);
} else {
$_[0] = Math::BigInt->new($strn)
--
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