testimg/winrgb4off.bmp 4-bit bmp with image data offset from header
testimg/winrgb8.bmp 8-bit bmp base
testimg/winrgb8off.bmp 8-bit bmp with image data offset from header
+testimg/zerotype.jpg Image with a zero type entry in the EXIF data
tga.c Reading and writing Targa files
tiff.c
trans2.c
entry->tag = tiff_get16(tiff, base);
entry->type = tiff_get16(tiff, base+2);
entry->count = tiff_get32(tiff, base+4);
- if (entry->type >= 1 || entry->type <= ift_last) {
+ if (entry->type >= 1 && entry->type <= ift_last) {
entry->item_size = type_sizes[entry->type];
entry->size = entry->item_size * entry->count;
if (entry->size / entry->item_size != entry->count) {
use strict;
use lib 't';
use Imager qw(:all);
-use Test::More tests => 56;
+use Test::More tests => 57;
init_log("testout/t101jpeg.log",1);
$im = Imager->new(xsize=>2, ysize=>2);
ok(!$im->write(file=>"testout/nojpeg.jpg"), "should fail to write jpeg");
cmp_ok($im->errstr, '=~', qr/format not supported/, "check no jpeg message");
- skip("no jpeg support", 52);
+ skip("no jpeg support", 53);
}
} else {
open(FH,">testout/t101.jpg") || die "cannot open testout/t101.jpg for writing\n";
is($im->errstr, "only 1 or 3 channels images can be saved as JPEG",
"check the error message");
}
+ SKIP:
+ { # Issue # 18496
+ # If a jpeg with EXIF data containing an (invalid) IFD entry with a
+ # type of zero is read then Imager crashes with a Floating point
+ # exception
+ # testimg/zerojpeg.jpg was manually modified from exiftest.jpg to
+ # reproduce the problem.
+ Imager::i_exif_enabled()
+ or skip("no exif support", 1);
+ my $im = Imager->new;
+ ok($im->read(file=>'testimg/zerotype.jpg'), "shouldn't crash");
+ }
}