Subject: | ExtraField values in constructor aren't checked properly |
The ExtraField values in the constructor aren't checked properly. For
example, this doesn't throw an error but should because there is a
3-character id ('bad'):
#!/usr/bin/perl
use strict;
use warnings;
use IO::Compress::Gzip;
my $gzip = IO::Compress::Gzip->new('file.txt',
ExtraField => [
at => 'mouse',
bad => 'dog',
],
);
This is because IO/Compress/Zlib/Extra.pm is attempting to iterate over
the data by doing this:
for (my $ix = 0; $ix <= length(@$data) -1 ; $ix += 2) {
When it really wants:
for (my $ix = 0; $ix <= @$data - 1; $ix += 2) {
(length(@$data) is returning 1 - the length of the string '4')
-- Matthew Horsfall (alh)