Project

General

Profile

Bug #11513

IPAddr should reject invalid formats

Added by kachick (Kenichi Kamiya) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-06-20 trunk 50978) [x86_64-linux]
[ruby-core:<unknown>]

Description

Is this intended behavior?

A patch is PR#942(https://github.com/ruby/ruby/pull/942)

require 'ipaddr'

IPAddr.new "[2001:200:300::] INVALID" #=> IPAddr::InvalidAddressError: invalid address
IPAddr.new "192.168.0.1/32 INVALID"  #=> IPAddr::InvalidAddressError: invalid address
IPAddr.new "[2001:200:300::]\nINVALID" #=> #<IPAddr: IPv6:2001:0200:0300:0000:0000:0000:0000:0000/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>, expected: IPAddr::InvalidAddressError
IPAddr.new "192.168.0.1/32\nINVALID"  #=> #<IPAddr: IPv4:192.168.0.1/255.255.255.255>, expected: IPAddr::InvalidAddressError or IPAddr::InvalidPrefixError
#1

Updated by hsbt (Hiroshi SHIBATA) about 5 years ago

  • Status changed from Open to Closed

Applied in changeset r52244.


Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Updated by usa (Usaku NAKAMURA) about 5 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r52360 merged revision(s) 52244.

Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

r52244 and (partially) r50727 were backported into ruby_2_2 branch at r52741.

Also available in: Atom PDF