Subject: | Segfault in convert with bad params |
If you hand Imager->convert a bad matrix param, it will segfault.
Inclosed is a patch that checks the params and spits out an error if
something is wrong.
Subject: | Philip-Gwyn_Imager_matrix_segfault-01.diff |
Only in Imager-0.92/CountColor: CountColor.bs
Only in Imager-0.92/CountColor: CountColor.c
Only in Imager-0.92/CountColor: CountColor.o
Only in Imager-0.92/CountColor: Makefile
Only in Imager-0.92/CountColor: pm_to_blib
Only in Imager-0.92/DynTest: DynTest.bs
Only in Imager-0.92/DynTest: DynTest.c
Only in Imager-0.92/DynTest: DynTest.o
Only in Imager-0.92/DynTest: Makefile
Only in Imager-0.92/DynTest: linstretch.o
Only in Imager-0.92/DynTest: pm_to_blib
Only in Imager-0.92/FT2: FT2.bs
Only in Imager-0.92/FT2: FT2.c
Only in Imager-0.92/FT2: FT2.o
Only in Imager-0.92/FT2: Makefile
Only in Imager-0.92/FT2: freetyp2.o
Only in Imager-0.92/FT2: pm_to_blib
Only in Imager-0.92/FT2: testout
Only in Imager-0.92/Flines: Flines.bs
Only in Imager-0.92/Flines: Flines.c
Only in Imager-0.92/Flines: Flines.o
Only in Imager-0.92/Flines: Makefile
Only in Imager-0.92/Flines: pm_to_blib
Only in Imager-0.92/GIF: GIF.bs
Only in Imager-0.92/GIF: GIF.c
Only in Imager-0.92/GIF: GIF.o
Only in Imager-0.92/GIF: Makefile
Only in Imager-0.92/GIF: imgif.o
Only in Imager-0.92/GIF: pm_to_blib
Only in Imager-0.92/GIF: testout
Only in Imager-0.92/ICO: ICO.bs
Only in Imager-0.92/ICO: ICO.c
Only in Imager-0.92/ICO: ICO.o
Only in Imager-0.92/ICO: Makefile
Only in Imager-0.92/ICO: imicon.o
Only in Imager-0.92/ICO: msicon.o
Only in Imager-0.92/ICO: pm_to_blib
Only in Imager-0.92/ICO: testout
Only in Imager-0.92/: Imager.bs
Only in Imager-0.92/: Imager.c
Only in Imager-0.92/: Imager.o
diff -rub Imager-0.92-ORIG/Imager.pm Imager-0.92/Imager.pm
--- Imager-0.92-ORIG/Imager.pm 2012-08-14 05:33:54.000000000 -0400
+++ Imager-0.92/Imager.pm 2012-09-28 16:07:43.000000000 -0400
@@ -3575,6 +3575,15 @@
}
else {
$matrix = $opts{matrix};
+ unless( 'ARRAY' eq ref $matrix ) {
+ $self->{ERRSTR} = "convert matrix must be an arrayref of arrayrefs";
+ return undef;
+ }
+ foreach my $ch ( @$matrix ) {
+ next if 'ARRAY' eq ref $ch;
+ $self->{ERRSTR} = "convert matrix must be an arrayref of arrayrefs";
+ return undef;
+ }
}
my $new = Imager->new;