RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 710373 - Bad exception on entering invalid netaddr.IPNetwork
Summary: Bad exception on entering invalid netaddr.IPNetwork
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-netaddr
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jakub Hrozek
QA Contact: IDM QE LIST
URL:
Whiteboard:
Depends On: 709701
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-03 08:25 UTC by Jakub Hrozek
Modified: 2011-12-06 16:37 UTC (History)
6 users (show)

Fixed In Version: python-netaddr-0.7.5-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 709701
Environment:
Last Closed: 2011-12-06 16:37:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1658 0 normal SHIPPED_LIVE python-netaddr bug fix update 2011-12-06 00:50:23 UTC

Description Jakub Hrozek 2011-06-03 08:25:41 UTC
+++ This bug was initially created as a clone of Bug #709701 +++

Description of problem:
If an IPNetwork object is instantiated with bad data, the python-netaddr code tries to access an unbound local variable. It should raise an appropriate exception instead.

This means that a user of python-netaddr must check for all exceptions instead of just expecting netaddr.core.AddrFormatError.

Version-Release number of selected component (if applicable):
python-netaddr-0.7.5-2

How reproducible:
always

Steps to Reproduce:
1. python -c "import netaddr; netaddr.IPNetwork('3333/32')"
  
Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 919, in __init__
    implicit_prefix, flags)
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 782, in parse_ip_network
    value = ip._value
UnboundLocalError: local variable 'ip' referenced before assignment


Expected results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 926, in __init__
    raise AddrFormatError('invalid IPNetwork %s' % addr)
netaddr.core.AddrFormatError: invalid IPNetwork 3333/32


Additional info:
Upstream was tracking this as issue #2 and #5 in github

--- Additional comment from updates on 2011-06-02 02:08:36 EDT ---

python-netaddr-0.7.5-3.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/python-netaddr-0.7.5-3.fc15

--- Additional comment from updates on 2011-06-03 01:28:04 EDT ---

Package python-netaddr-0.7.5-3.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-netaddr-0.7.5-3.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/python-netaddr-0.7.5-3.fc15
then log in and leave karma (feedback).

Comment 4 Namita Soman 2011-11-16 14:18:27 UTC
Verified using python-netaddr-0.7.5-4.el6.noarch

Steps taken to verify:
# python -c "import netaddr; netaddr.IPNetwork('3333/32')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/netaddr/ip/__init__.py", line 926, in __init__
    raise AddrFormatError('invalid IPNetwork %s' % addr)
netaddr.core.AddrFormatError: invalid IPNetwork 3333/32

Comment 5 errata-xmlrpc 2011-12-06 16:37:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1658.html


Note You need to log in before you can comment on or make changes to this bug.