Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

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

People
Owner: TONYC [...] cpan.org
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.44
  • 0.44_01
  • 0.45
  • 0.45_02
  • 0.46
  • 0.47
  • 0.48
  • 0.49
Fixed in: (no value)



Subject: writing a 2 or 4 channel jpeg to a scalar causes a segmentation fault
The following produces a segmentation fault: perl -MImager -e 'my $im = Imager->new(xsize => 100, ysize=>100, channels => 4); $im->write(data=>\$foo, type=>"jpeg")' This occurs because when the channel count is checked the iolayer passed in hasn't been completely constructed, causing a NULL pointer deref when it's destroyed. There will be a 0.50 fix release within the next few days. Workaround: check the channel count for an image is 1 or 3 channels before attempting to save it as a jpeg. The following path fixes the problem. The next full release of Imager will move the code from io_commit_types() into the base constructor, preventing this problem in general. --- jpeg.c.orig 2006-03-28 10:54:41.000000000 +1000 +++ jpeg.c 2006-03-28 10:55:33.000000000 +1000 @@ -413,6 +413,7 @@ mm_log((1,"i_writejpeg(im %p, ig %p, qfactor %d)\n", im, ig, qfactor)); i_clear_error(); + io_glue_commit_types(ig); if (!(im->channels==1 || im->channels==3)) { i_push_error(0, "only 1 or 3 channels images can be saved as JPEG"); @@ -433,7 +434,6 @@ return 0; } - io_glue_commit_types(ig); jpeg_wiol_dest(&cinfo, ig); cinfo.image_width = im -> xsize; /* image width and height, in pixels */
this is also a problem when writing 2 channel tga files
fixed in 0.49_01 dev release. This ticket will be resolved when 0.50 is released.
fixed in 0.50