Issue #11513 has been updated by Tomoyuki Chikanaga.

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

----------------------------------------
Bug #11513: IPAddr should reject invalid formats
https://bugs.ruby-lang.org/issues/11513#change-54549

* Author: Kenichi Kamiya
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-06-20 trunk 50978) [x86_64-linux]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
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
~~~




-- 
https://bugs.ruby-lang.org/