Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 128208
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: ritchey.mulhollem [...] protonmail.com
Cc:
AdminCc:

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



Subject: Segfault
Date: Thu, 10 Jan 2019 04:45:10 +0000
To: "bug-Imager [...] rt.cpan.org" <bug-Imager [...] rt.cpan.org>
From: Ritchey Mulhollem <ritchey.mulhollem [...] protonmail.com>
Getting a segfault when making a circle. [wolf@Wolflake] cgi-bin $sudo perl test.pl Segmentation fault [wolf@Wolflake] cgi-bin $ use strict; use warnings; use LWP::Simple; use Imager; for(1..3){ getstore("https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/sp/0$_/2400x2400.jpg", "band-$_.jpg") } my $B = Imager->new;# Band 1 .47um (blue) $B->read(file=>"band-1.jpg") or die $B->errstr; my $R = Imager->new;# Band 2 .64um (red) $R->read(file=>"band-2.jpg") or die $R->errstr; my $G = Imager->new;# Band 3 .86um (Near IR [Veggie]) $G->read(file=>"band-3.jpg") or die $G->errstr; $G->filter(type=>"contrast", intensity=>.9); #No saturation? Seriously? $G->filter(type=>"saturation", intensity=>-0.5); # make an RGB image from Red, IR, and Blue images my $RGB = Imager->combine(src => [ $R, $G, $B ]);# Order is [RED, GREEN, BLUE] for ploting polyline below--> $RGB->write(file=>"RGB.jpg");exit; my $origin=[1380,820];# upper left #my @center=[1470, 840]; my @center=[470, 440]; my $color=Imager::Color->new(255,0,0); $RGB->circle (aa=>1, color=>$color, r=>100, x=>$center[0], y=>$center[1], filled=>1); $RGB->polyline(aa=>1, color=>$color, points=> [ $origin, [2050,790], [1950,1200], [1260,1210], $origin ]); # same as in IrfanView when a point is click-held. top/left, top/right, bot/right, bot/left, back to top/left my $OUT = $RGB->crop(left=>190, top=>164, width=>2210, height=>2009); # same as in IrfanView crop information when set to 100% zoom $OUT->write(file=>time."_GEOS-16_Color.jpg") or die $OUT->errstr;
On Thu Jan 10 00:01:04 2019, ritchey.mulhollem@protonmail.com wrote: Show quoted text
> Getting a segfault when making a circle. > > [wolf@Wolflake] cgi-bin $sudo perl test.pl > Segmentation fault > [wolf@Wolflake] cgi-bin $ > > use strict; > use warnings; > > use LWP::Simple; > use Imager; > > for(1..3){ > getstore("https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/sp/0$_/2400x2400.jpg", > "band-$_.jpg") > } > > my $B = Imager->new;# Band 1 .47um (blue) > $B->read(file=>"band-1.jpg") or die $B->errstr; > > my $R = Imager->new;# Band 2 .64um (red) > $R->read(file=>"band-2.jpg") or die $R->errstr; > > my $G = Imager->new;# Band 3 .86um (Near IR [Veggie]) > $G->read(file=>"band-3.jpg") or die $G->errstr; > $G->filter(type=>"contrast", intensity=>.9); > #No saturation? Seriously? $G->filter(type=>"saturation", > intensity=>-0.5); > > # make an RGB image from Red, IR, and Blue images > my $RGB = Imager->combine(src => [ $R, $G, $B ]);# Order is [RED, > GREEN, BLUE] for ploting polyline below--> $RGB-
> >write(file=>"RGB.jpg");exit;
> > my $origin=[1380,820];# upper left > #my @center=[1470, 840]; > my @center=[470, 440]; > my $color=Imager::Color->new(255,0,0); > > $RGB->circle (aa=>1, color=>$color, r=>100, x=>$center[0], > y=>$center[1], filled=>1); > $RGB->polyline(aa=>1, color=>$color, points=> [ $origin, [2050,790], > [1950,1200], [1260,1210], $origin ]); # same as in IrfanView when a > point is click-held. top/left, top/right, bot/right, bot/left, back to > top/left > my $OUT = $RGB->crop(left=>190, top=>164, width=>2210, height=>2009); > # same as in IrfanView crop information when set to 100% zoom > > $OUT->write(file=>time."_GEOS-16_Color.jpg") or die $OUT->errstr;
Thanks for the report, I've reproduced this. This is a bug in Imager, but you should be able to work around it. You initialize @center: my @center=[470, 440]; which means that @center has a single element, which is a reference to an array. I suspect you meant: my @center=(470, 440); I'll release a fix for Imager in the next few days. I may make it warn or die if passed a reference for a numeric parameter. Tony
Subject: Re: [rt.cpan.org #128208] Segfault
Date: Thu, 10 Jan 2019 15:26:45 +0000
To: "bug-Imager [...] rt.cpan.org" <bug-Imager [...] rt.cpan.org>
From: Ritchey Mulhollem <ritchey.mulhollem [...] protonmail.com>
Well that's embarrassing! Yes I did indeed intend to initialize an array, not make a reference to it. Serves me right for coding late at night. Thank you for fixing MY bug! ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, January 10, 2019 6:21 AM, TONYC via RT <bug-Imager@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=128208 > > > On Thu Jan 10 00:01:04 2019,ritchey.mulhollem@protonmail.com wrote: >
> > Getting a segfault when making a circle. > > [wolf@Wolflake] cgi-bin $sudo perl test.pl > > Segmentation fault > > [wolf@Wolflake] cgi-bin $ > > use strict; > > use warnings; > > use LWP::Simple; > > use Imager; > > for(1..3){ > > getstore("https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/sp/0$/2400x2400.jpg", > > "band-$.jpg")} > > my $B = Imager->new;# Band 1 .47um (blue) > > $B->read(file=>"band-1.jpg") or die $B->errstr; > > my $R = Imager->new;# Band 2 .64um (red) > > $R->read(file=>"band-2.jpg") or die $R->errstr; > > my $G = Imager->new;# Band 3 .86um (Near IR [Veggie]) > > $G->read(file=>"band-3.jpg") or die $G->errstr; > > $G->filter(type=>"contrast", intensity=>.9); > > #No saturation? Seriously? $G->filter(type=>"saturation", > > intensity=>-0.5); > > > > make an RGB image from Red, IR, and Blue images > > > > ================================================ > > > > my $RGB = Imager->combine(src => [ $R, $G, $B ]);# Order is [RED, > > GREEN, BLUE] for ploting polyline below--> $RGB- > >
> > > write(file=>"RGB.jpg");exit;
> > > > my $origin=[1380,820];# upper left > > #my @center=[1470, 840]; > > my @center=[470, 440]; > > my $color=Imager::Color->new(255,0,0); > > $RGB->circle (aa=>1, color=>$color, r=>100, x=>$center[0], > > y=>$center[1], filled=>1); > > $RGB->polyline(aa=>1, color=>$color, points=> [ $origin, [2050,790], > > [1950,1200], [1260,1210], $origin ]); # same as in IrfanView when a > > point is click-held. top/left, top/right, bot/right, bot/left, back to > > top/left > > my $OUT = $RGB->crop(left=>190, top=>164, width=>2210, height=>2009); > > > > same as in IrfanView crop information when set to 100% zoom > > > > ============================================================ > > > > $OUT->write(file=>time."_GEOS-16_Color.jpg") or die $OUT->errstr;
> > Thanks for the report, I've reproduced this. > > This is a bug in Imager, but you should be able to work around it. > > You initialize @center: > > my @center=[470, 440]; > > which means that @center has a single element, which is a reference to an array. > > I suspect you meant: > > my @center=(470, 440); > > I'll release a fix for Imager in the next few days. > > I may make it warn or die if passed a reference for a numeric parameter. > > Tony
On Thu Jan 10 07:21:47 2019, TONYC wrote: Show quoted text
> This is a bug in Imager, but you should be able to work around it. >
... Show quoted text
> > I'll release a fix for Imager in the next few days.
Fixed in Imager 1.009. Show quoted text
> I may make it warn or die if passed a reference for a numeric > parameter.
Passing an unoverloaded reference to most low-level Imager functions (which the high-level functions eventually call) will produce a perl exception from 1.009. Tony