Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 35172
Status: resolved
Priority: 20/
Queue: Imager

People
Owner: Nobody in particular
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

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



Subject: SEGV: $img->scale( x
$img->scale(xpixels => {}) makes segmentation fault. my machine is: Linux klab-emerson 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux perl: This is perl, v5.8.4 built for i386-linux-thread-multi Imager: 0.63(r1465) reproducible code is follow: Show quoted text
>||
use strict; use warnings; use Imager; print "Imager version is: $Imager::VERSION\n"; my $img = Imager->new(xsize => 100, ysize => 100); my $scaled = $img->scale(xpixels => {}) or die $img->errstr; ||<
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #35172] SEGV: $img->scale( x
Date: Fri, 18 Apr 2008 14:44:02 +1000
To: Tokuhiro Matsuno via RT <bug-Imager [...] rt.cpan.org>
From: Tony Cook <tony [...] develop-help.com>
On Thu, Apr 17, 2008 at 11:06:46PM -0400, Tokuhiro Matsuno via RT wrote: Show quoted text
> $img->scale(xpixels => {}) makes segmentation fault. > > my machine is: Linux klab-emerson 2.6.8-2-386 #1 Tue Aug 16 12:46:35 > UTC 2005 i686 GNU/Linux > perl: This is perl, v5.8.4 built for i386-linux-thread-multi > Imager: 0.63(r1465) > > reproducible code is follow:
> >||
> use strict; > use warnings; > use Imager; > > print "Imager version is: $Imager::VERSION\n"; > > my $img = Imager->new(xsize => 100, ysize => 100); > my $scaled = $img->scale(xpixels => {}) or die $img->errstr; > ||<
Thanks for reporting this. I've found the cause for this. The reference parameter was automatically converted to a large integer by perl, which resulted in an attempt to scale to a very large size. The low level image creation code (i_img_new_ch()) checked for integer overflow in calculating the image memory allocation and failed, returning NULL. The i_scale_axis() code didn't check for this failure and attempted to use the NULL pointer. I've committed the following fix for this: - i_scale_axis() now checks for the failure, and fails itself by returning NULL if i_img_new_ch() fails - the scale_calculate() method, and hence scale() will now fail if any of the scale size parameters are references. - this also picked up an error in handling errors from the mixing scale type, which I've fixed. Your sample should output: scale_calculate: xpixels parameter cannot be a reference at foo.pl line 8. with the changes committed to svn. I'll do a release fairly soon for this. Tony
On Thu Apr 17 23:06:45 2008, TOKUHIROM wrote: Show quoted text
> $img->scale(xpixels => {}) makes segmentation fault. > > my machine is: Linux klab-emerson 2.6.8-2-386 #1 Tue Aug 16 12:46:35 > UTC 2005 i686 GNU/Linux > perl: This is perl, v5.8.4 built for i386-linux-thread-multi > Imager: 0.63(r1465) > > reproducible code is follow:
> >||
> use strict; > use warnings; > use Imager; > > print "Imager version is: $Imager::VERSION\n"; > > my $img = Imager->new(xsize => 100, ysize => 100); > my $scaled = $img->scale(xpixels => {}) or die $img->errstr; > ||<
Hi, This problem has been fixed in Imager 0.64, which I've just uploaded. Thanks for reporting it. Tony