Re: segfault in Imager 0.43
From: Tony Cook (firstname.lastname@example.org)
Date: Tue 24 Aug 2004 - 23:50:28 GMT
Next message: Peter Leonard: "Re: segfault in Imager 0.43"
> When converting to GIF the image is first converted to a paletted
> image, first a scan is done to produce a color table, then Imager
> does a translation from RGB to paletted using that table.
> It's crashing in the translation stage.
> I get the same result if I use a PNG file as input.
> I also get a crash if I call $thumb->to_paletted, so it's not a libungif
> I'll try to debug this and put a fix in CVS.
Ok, this is three different bugs:
1) scale() doesn't ensure that the output image is at least 1 pixel by 1
pixel. The scale(type=>'min', xpixels=>1, ypixels=>1) resulted in an
image 0 pixels high (since 1/118 = 0.00847 truncates to 0).
2) the low level image creation code doesn't ensure images are at least
1 x 1 pixels
3) the translation code (which takes an RGB image and a palette),
doesn't handle the case when an empty palette is passed in. Since the
image generated by scale has no pixels, the generated palette is empty,
and so the translation stage fails because it expects at least one color
in the palette.
I'll fix these as time permits.