diff --git a/Changes b/Changes index b899d6c..7c9bc51 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,13 @@ Revision history for Perl extension NetAddr::IP +4.022 + In Util.xs 1.28 + set uninitialized "carry" in XS bin2bcd to zero + + This insidious bug only showed up on 64 bit hosts running perl 5.6.2 + Thanks to Oliver Paukstadt for taking the + time to do the testing for me on his s390 system. + 4.021 Wed Dec 10 11:09:36 PST 2008 Removed test code that produces a warning about all perl versions, OOPS!! instead of just the buggy 5.8.0 - 5.8.5 versions. diff --git a/IP.pm b/IP.pm index 06e7cf7..092bd33 100644 --- a/IP.pm +++ b/IP.pm @@ -5,7 +5,7 @@ use strict; #use diagnostics; use NetAddr::IP::Lite 1.13 qw(Zero Zeros Ones V4mask V4net); -use NetAddr::IP::Util 1.27 qw( +use NetAddr::IP::Util 1.28 qw( sub128 inet_aton inet_any2n @@ -34,7 +34,7 @@ @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.21 $ =~ /\d+/g) }; +$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.22 $ =~ /\d+/g) }; =pod diff --git a/Lite/Util/Changes b/Lite/Util/Changes index da8702c..cc4a8ea 100644 --- a/Lite/Util/Changes +++ b/Lite/Util/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension NetAddr::IP::Util +1.28 Wed Dec 17 14:14:06 PST 2008 + set uninitialized "carry" in XS bin2bcd to zero + 1.27 Tue Dec 9 12:00:08 PST 2008 revised UtilPP v1.7 to work around perl 5.8.4 failures with certain @_ operations of goto &sub... diff --git a/Lite/Util/Makefile.PL b/Lite/Util/Makefile.PL index d9e19c0..7e2e09a 100644 --- a/Lite/Util/Makefile.PL +++ b/Lite/Util/Makefile.PL @@ -211,35 +211,6 @@ $begin . $inherited; } -sub MY::test { - package MY; - my $inherited = shift->SUPER::test(@_); - return $inherited unless $useXS; - my @orig = split(/\n/,$inherited); - my @txt = @orig; - my @lines; - - foreach(@orig) { - if ($_ !~ /^(?:test|testdb)_\w+/ && $_ =~ /^(test[^\s]*)\s+:/) { - my $new = ' pp'.$1; - $_ .= $new; - } - } - - foreach(@txt) { - $_ =~ s/TEST_TYPE/MTEST_TYPE/g; - next if $_ =~ /^#/ || /^TEST/; - $_ =~ s/subdirs/ppsubdirs/g; - $_ =~ s/test_/pptest_/g - unless $_ =~ /harness/; - $_ =~ s/testdb_/pptestdb_/g; - $_ =~ s/^test/pptest/; - $_ =~ s/([^\s]+)\$\(INST_LIB\)([^\s]+)/${1}tlib$2 $&/; - push @lines, $_; - } - my $line = join("\n",@orig,@lines); -} - sub MY::post_constants { my $post_constants = q| MY_POD2TEXT = |. $Config{scriptdirexp} .'/pod2text' .q| diff --git a/Lite/Util/Util.pm b/Lite/Util/Util.pm index 6c70f04..b0b2336 100644 --- a/Lite/Util/Util.pm +++ b/Lite/Util/Util.pm @@ -13,7 +13,7 @@ @ISA = qw(Exporter DynaLoader); -$VERSION = do { my @r = (q$Revision: 1.27 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.28 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; @EXPORT_OK = qw( inet_aton diff --git a/Lite/Util/Util.xs b/Lite/Util/Util.xs index ad53030..d22bcc3 100644 --- a/Lite/Util/Util.xs +++ b/Lite/Util/Util.xs @@ -67,6 +67,50 @@ #define zero ('0' & 0x7f) +/* useful for debug, prints the 128 bits of 8, 16 bit registers */ +void +printb128(char * b) +{ + int c; + for(c=0;c<16;c++) { + if (b[c] &0x80) + printf("1"); + else + printf("0"); + if (b[c] &0x40) + printf("1"); + else + printf("0"); + if (b[c] &0x20) + printf("1"); + else + printf("0"); + if (b[c] &0x10) + printf("1"); + else + printf("0"); + if (b[c] &0x8) + printf("1"); + else + printf("0"); + if (b[c] &0x4) + printf("1"); + else + printf("0"); + if (b[c] &0x2) + printf("1"); + else + printf("0"); + if (b[c] &0x1) + printf("1"); + else + printf("0"); + if (c == 3 || c == 7 || c == 11) + printf("\n"); + } + printf("\n\n"); +} + void extendipv4(void * aa, void * ux) { @@ -90,8 +134,7 @@ void fastcomp128(void * aa) { - register u_int32_t * a; - a = aa; + register u_int32_t * a = aa; *a++ ^= 0xffffffff; *a++ ^= 0xffffffff; @@ -357,7 +400,7 @@ int _bin2bcd (unsigned char * binary, BCD * n) { - register u_int32_t tmp, add3, msk8, bcd8, carry; + register u_int32_t tmp, add3, msk8, bcd8, carry = 0; u_int32_t word; unsigned char binmsk = 0; int c = 0,i, j, p; diff --git a/META.yml b/META.yml index aa428cf..f8920bc 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: NetAddr-IP -version: 4.021 +version: 4.022 abstract: Manages IPv4 and IPv6 addresses and subnets license: ~ author: