G
I have found a major flaw in a CPAN package. The package is
File::Binary and it has big endian and little endian unpack-ing
backwards. Likewise, all the test files are reversed so that the
tests all pass!
Why do I believe this is true?
From the perl manual on pack:
n,N unpacks a 16 or 32 bit integer in "network" or big endian order
v,V unpacks a 16 or 32 bit integer in "VAX" or little endian order
From the code:
if ($endian == $BIG_ENDIAN) {
$self->{_ui16} = 'v';
$self->{_ui32} = 'V';
} else {
$self->{_ui16} = 'n';
$self->{_ui32} = 'N';
}
When I 'od -x' the test files, they are clearly reversed:
od -x be.power10.n32.ints
0000000 ffff ffff f6ff ffff 9cff ffff 18fc
ffff
0000020 f0d8 ffff 6079 feff c0bd f0ff 8069
67ff
0000040 001f 0afa 0036 65c4
From the test file ".../File-Binary-1.7/t/17power10.n32.ints.be.t":
is($bin->get_si32(),-1); # 0xffffffff in B.E.
is($bin->get_si32(),-10); # 0xfffffff6 in B.E.
is($bin->get_si32(),-100); # 0xffffff9c in B.E.
is($bin->get_si32(),-1000); # 0xffff18fc in B.E.
so clearly this file contains little-endian integers.
OK, so there is a mistake here -- I would like to submit a fix to all
this -- my question is how do I go about doing this? I have contacted
the author, but no response.
Any help/guidance would be appreciated. When I get this fixed, then
I'll be able to submit my new module to CPAN (my first attempt).
Thanks!
File::Binary and it has big endian and little endian unpack-ing
backwards. Likewise, all the test files are reversed so that the
tests all pass!
Why do I believe this is true?
From the perl manual on pack:
n,N unpacks a 16 or 32 bit integer in "network" or big endian order
v,V unpacks a 16 or 32 bit integer in "VAX" or little endian order
From the code:
if ($endian == $BIG_ENDIAN) {
$self->{_ui16} = 'v';
$self->{_ui32} = 'V';
} else {
$self->{_ui16} = 'n';
$self->{_ui32} = 'N';
}
When I 'od -x' the test files, they are clearly reversed:
od -x be.power10.n32.ints
0000000 ffff ffff f6ff ffff 9cff ffff 18fc
ffff
0000020 f0d8 ffff 6079 feff c0bd f0ff 8069
67ff
0000040 001f 0afa 0036 65c4
From the test file ".../File-Binary-1.7/t/17power10.n32.ints.be.t":
is($bin->get_si32(),-1); # 0xffffffff in B.E.
is($bin->get_si32(),-10); # 0xfffffff6 in B.E.
is($bin->get_si32(),-100); # 0xffffff9c in B.E.
is($bin->get_si32(),-1000); # 0xffff18fc in B.E.
so clearly this file contains little-endian integers.
OK, so there is a mistake here -- I would like to submit a fix to all
this -- my question is how do I go about doing this? I have contacted
the author, but no response.
Any help/guidance would be appreciated. When I get this fixed, then
I'll be able to submit my new module to CPAN (my first attempt).
Thanks!