$new->{IMG} = i_convert($self->{IMG}, $matrix);
unless ($new->{IMG}) {
# most likely a bad matrix
+ i_push_error(0, "convert");
$self->{ERRSTR} = _error_as_msg();
return undef;
}
if (len > inchan)
inchan = len;
}
+ else {
+ i_push_errorf(0, "invalid matrix: element %d is not an array ref", j);
+ XSRETURN(0);
+ }
}
coeff = mymalloc(sizeof(double) * outchan * inchan);
for (j = 0; j < outchan; ++j) {
#!perl -w
use strict;
use Imager qw(:all :handy);
-use Test::More tests => 27;
+use Test::More tests => 29;
use Imager::Test qw(test_colorf_gpix is_fcolor1 is_fcolor3);
-d "testout" or mkdir "testout";
my $conv = $im->convert(preset => 'grey');
is($conv->bits, 'double', 'make sure result has extra bits');
}
+
+{ # http://rt.cpan.org/NoAuth/Bug.html?id=79922
+ # Segfault in convert with bad params
+ my $im = Imager->new(xsize => 10, ysize => 10);
+ ok(!$im->convert(matrix => [ 10, 10, 10 ]),
+ "this would crash");
+ is($im->errstr, "convert: invalid matrix: element 0 is not an array ref",
+ "check the error message");
+}