Subject: | tidy() loops on zero polynomial |
Distribution: M/MA/MATKIN/Math-Polynomial-0.03.tar.gz
Perl version: 5.8.2 (of no apparent significance)
Example code:
perl -MMath::Polynomial -e 'Math::Polynomial->new->tidy'
perl -MMath::Polynomial -e 'Math::Polynomial->new(0,0,0)->tidy'
Error description:
Method tidy() loops endlessly on zero polynomials.
Proposed fix:
--- Polynomial.pm.old Fri Feb 23 12:53:18 2001
+++ Polynomial.pm Tue Dec 30 16:01:30 2003
@@ -294,7 +294,7 @@
sub tidy {
my $self = shift;
- shift(@$self) while $self->[0] == 0;
+ shift(@$self) while @$self && $self->[0] == 0;
}
=head1 OPERATORS