Can't locate object method "new" via package "Imager::Color::Float" ...
- having the color parameter code create floating point colors could
cause other problems too, since most of the underlying functions can't
handle them, so removed the attempt to create float colors.
Fixes #18561
$result = Imager::Color->new(%$arg);
}
elsif ($copy =~ /^ARRAY\(/) {
- if (grep $_ > 1, @$arg) {
- $result = Imager::Color->new(@$arg);
- }
- else {
- $result = Imager::Color::Float->new(@$arg);
- }
+ $result = Imager::Color->new(@$arg);
}
else {
$Imager::ERRSTR = "Not a color";
t/t92samples.t
t/t93podcover.t POD Coverage tests
t/testtools.pl
+t/tr18561.t Regression tests
+t/tr18561b.t
tags.c
testimg/209_yonge.jpg Regression test: #17981
testimg/bad1oflow.bmp 1-bit/pixel, overflow integer on 32-bit machines
--- /dev/null
+#!perl -w
+# regression test for RT issue 18561
+#
+use strict;
+use Test::More tests => 1;
+eval {
+ use Imager;
+
+ my $i = Imager->new(
+ xsize => 50,
+ ysize => 50,
+ );
+
+ $i->setpixel(
+ x => 10,
+ y => 10,
+ color => [0, 0, 0],
+ );
+};
+ok(!$@, "shouldn't crash")
+ or print "# $@\n";
--- /dev/null
+#!perl -w
+# variant on the code that produces 18561
+# the old _color() code could return floating colors in some cases
+# but in most cases the caller couldn't handle it
+use strict;
+use Test::More tests => 1;
+eval {
+ use Imager;
+ use Imager::Color::Float; # prevent the actual 18561 crash
+ my $i = Imager->new(
+ xsize => 50,
+ ysize => 50,
+ );
+ $i->line(x1 => 0, y1 => 0, x2 => 99, y2=>99, color => [ 0, 0, 0 ]);
+};
+ok(!$@, "shouldn't crash")
+ or print "# $@\n";