Subject: | Problem with CWS files using Image::Size 3.01 && Compress::Zlib 1.42 |
I found a problem with flash6 (CWS) using Image::Size 3.01 &&
Compress::Zlib 1.42
Script fails if we try process two CWS files with different name in a
row:
================
#!/usr/bin/perl -w
use IO::File;
use Image::Size qw(:all);
use Test::More tests => 1;
($dir = $0) =~ s/\w+\.t$//o;
# This test fails on Image::Size 3.01 and Compress::Zlib 1.42
($x, $y, $id) = imgsize("${dir}8.swf");
($x2, $y2, $id2) = imgsize("${dir}8_1.swf");
ok(($x == 280 && $y == 140 && $id eq 'CWS' && $x2 == 280 &&
$y2 == 140 && $id2 eq 'CWS'), 'Two flash CWS files test');
exit;
================
This patch helps:
=============
--- Size.pm 2006-09-14 11:48:03.000000000 +0400
+++ Size_patched.pm 2007-06-30 23:06:50.000000000 +0400
@@ -1128,7 +1128,8 @@
my $ver = _bin2int(unpack 'B8', substr($header, 3, 1));
my ($d, $status) = Compress::Zlib::inflateInit();
- $header = $d->inflate(substr($header, 8, 1024));
+ $header=substr($header, 8, 1024);
+ $header = $d->inflate($header);
my $bs = unpack 'B133', substr($header, 0, 9);
my $bits = _bin2int(substr($bs, 0, 5));
=============
I do not know why does this patch helps. I can't explain it, but is
does. (To create this patch I used recomendations for Image::Size
2.992, that really helps to process flash6. I do not know how that
unknown person reached that solution. The real difference
between that recomendations and Image::Size 3.01 is the patch
I've just posted here)
Note, that everything works well without this patch with
Compress::Zlib 2.004. This problem should be tested with
Compress::Zlib 1.42 only.
Here is an attached file Image_Size_test_and_patch.tgz with test,
patch and swf files included.
==================================
$ perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
$ perl -e 'use Compress::Zlib; print $Compress::Zlib::VERSION,"\n";'
1.42
$ perl -e'use Image::Size; print $Image::Size::VERSION,"\n";'
3.01
$ cat /etc/issue
Debian GNU/Linux lenny/sid \n \l
Subject: | Image_Size_test_and_patch.tgz |
Message body not shown because it is not plain text.