Skip Menu |

This queue is for tickets about the GD-SecurityImage CPAN distribution.

Report information
The Basics
Id: 33629
Status: resolved
Estimated: 10 min
Worked: 10 min
Priority: 0/
Queue: GD-SecurityImage

People
Owner: Nobody in particular
Requestors: Matthew.Franglen [...] semantico.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.65



Subject: particle() will hang if largest image dimension is <= 19
Date: Wed, 27 Feb 2008 15:05:06 +0000
To: bug-GD-SecurityImage [...] rt.cpan.org
From: Matthew Franglen <Matthew.Franglen [...] semantico.com>
Dear Sir, GD::SecurityImage Version 1.64 I have discovered that the particle() method will hang if the largest dimension of the image is less than 20. This will occur regardless of any settings passed to particle. Looking at the code, the problem section appears to be: my $big = $self->{height} > $self->{width} ? $self->{height} : $self->{width}; my $f = shift || $big * 20; # particle density my $dots = shift || 1; # number of multiple dots my $int = int $big / 20; my @random; for (my $x = $int; $x <= $big; $x += $int) { push @random, $x; } With a maximum size of 19 or less, $big becomes 19 or less. This means that $int becomes 0. This means that the loop never completes, as the variable $x is incremented by 0 each round. The following code will demonstrate the issue: perl -MGD::SecurityImage -e 'GD::SecurityImage->new( width => 1, height => 1 )->random()->create()->particle();' Regards, -- Matthew Franglen Software Developer Semantico, Floor 1, 21-23 Dyke Road, Brighton BN1 3FE t: +44 1273 358221 f: +44 1273 723232 e: Matthew.Franglen@semantico.com w: www.semantico.com
From: burak [...] cpan.org
Thanks for reporting. Fixed in 1.65. 27 Şub. 2008 Çar., 10:30:23 tarihinde, Matthew.Franglen@semantico.com yazdı: Show quoted text
> Dear Sir, > > GD::SecurityImage Version 1.64 > > I have discovered that the particle() method will hang if the largest > dimension of the image is less than 20. This will occur regardless of > any settings passed to particle. Looking at the code, the problem > section appears to be: > > my $big = $self->{height} > $self->{width} ? $self->{height} : > $self->{width}; > my $f = shift || $big * 20; # particle density > my $dots = shift || 1; # number of multiple dots > my $int = int $big / 20; > > my @random; > for (my $x = $int; $x <= $big; $x += $int) { > push @random, $x; > } > > With a maximum size of 19 or less, $big becomes 19 or less. This
means Show quoted text
> that $int becomes 0. This means that the loop never completes, as the > variable $x is incremented by 0 each round. > > The following code will demonstrate the issue: > > perl -MGD::SecurityImage -e 'GD::SecurityImage->new( width => 1,
height Show quoted text
> => 1 )->random()->create()->particle();' > > Regards, >