Subject: | Image::Size die on truncated file |
Image::Size die on truncated file:
'x' outside of string in unpack at lib/Image/Size.pm
It seems to be unpcak bug, because it should not die, but it die.
Patch attached.
Subject: | patch-Image-Size.pm |
--- Image/Size.pm.orig 2008-11-26 14:53:47.000000000 +0300
+++ Image/Size.pm 2008-11-26 15:10:34.000000000 +0300
@@ -949,7 +949,10 @@
{
# Segments that contain size info
$length = 5;
- ($y, $x) = unpack("xnn", &$read_in($stream, $length));
+ my $buf = &$read_in($stream, $length);
+ # unpack die on truncated data
+ last if length($buf) < $length;
+ ($y, $x) = unpack("xnn", $buf);
$id = 'JPG';
last;
}