You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2013/12/30 23:56:51 UTC
[jira] [Resolved] (NET-521)
SubnetUtils.SubnetInfo.getAddressCount() can overflow as it returns an int
[ https://issues.apache.org/jira/browse/NET-521?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved NET-521.
----------------------
Resolution: Fixed
URL: http://svn.apache.org/r1554332
Log:
NET-521 SubnetUtils.SubnetInfo.getAddressCount() can overflow as it returns an int
Modified:
commons/proper/net/trunk/src/changes/changes.xml
commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java
commons/proper/net/trunk/src/test/java/org/apache/commons/net/SubnetUtilsTest.java
> SubnetUtils.SubnetInfo.getAddressCount() can overflow as it returns an int
> --------------------------------------------------------------------------
>
> Key: NET-521
> URL: https://issues.apache.org/jira/browse/NET-521
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 3.3
> Reporter: Sebb
>
> The method SubnetUtils.SubnetInfo.getAddressCount() returns an int.
> However a CIDR with 0 or 1 bits in the routing mask can represent more than Integer.MAX_VALUE entries, so the method cannot currently return the correct value.
> Unfortunately, if the method were changed to return a long it would break binary compatibility (the return type is part of the API signature).
> One possible solution is to provide a new method which returns a long, and deprecate the old method.
> If the original method cannot return the correct value, it should probably throw a runtime error.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)