Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Validate-IP CPAN distribution.

Report information
The Basics
Id: 93622
Status: resolved
Priority: 0/
Queue: Data-Validate-IP

People
Owner: Nobody in particular
Requestors: brian.bickerton [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.22
Fixed in: 0.23



Perl: 5.14.4 OS: SunOS dev1 5.11 omnios-d3950d8 i86pc i386 i86pc Solaris Function: is_public_ipv6(), internally using _slow_is_ipv6() Input ":11" Error: "Bad arg length for NetAddr::IP::Util::sub128, length is 0, should be 128" While parsing some HTTP headers for ips with is_public_ipv4() and is_public_ipv6(), I came across the input and resulting error listed above. It passes the parsing of _slow_is_ipv6. When fed to NetAddr::IP->new6(), the result is undefined. Passing undefined to $network->contains() causes the error. I have attached a short test script and a patch. The patch fixes both the _slow_is_ipv6 such that it fails leading single colons as invalid, as well as returning early if in is_[network]_ipv[4,6]() subs if NetAddr::IP->[new,new6]() is undefined.
Subject: IP.pm.diff
145c145 < elsif ($empty > 1) { --- > elsif ($empty > 1 || $value =~ /^:/) { 450c450 < my $netaddr_ip = NetAddr::IP->%s($ip); --- > my $netaddr_ip = NetAddr::IP->%s($ip) or return; 475c475 < my $netaddr_ip = NetAddr::IP->%s($ip); --- > my $netaddr_ip = NetAddr::IP->%s($ip) or return;
Subject: test.pl
use strict; use warnings; use Data::Validate::IP; Data::Validate::IP::is_public_ipv6(':11');