Inefficient validation functions

Bug #1431367 reported by George Peristerakis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Kamil Rykowski

Bug Description

In the functions validate_port_range and validate_ip_protocol are very inefficient. For the a valid value, the function does a comparison of the entire range in a list of possible valid integers.

x in range(-1, 65536) should be replaced with -1 <= x < 65536

Changed in horizon:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by George Peristerakis (<email address hidden>) on branch: master
Review: https://review.openstack.org/163822

Sam Betts (sambetts)
Changed in horizon:
assignee: nobody → Sam Betts (sambetts)
Revision history for this message
Sam Betts (sambetts) wrote :

This appears to be being fixed by this patch: https://review.openstack.org/#/c/116508

Changed in horizon:
assignee: Sam Betts (sambetts) → nobody
Changed in horizon:
assignee: nobody → Kamil Rykowski (kamil-rykowski)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/116508
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=dd9fb91a3196c9e457789ca4c10b5d241b7d6456
Submitter: Jenkins
Branch: master

commit dd9fb91a3196c9e457789ca4c10b5d241b7d6456
Author: Wlodzimierz Borkowski <wlodek <email address hidden>>
Date: Sun Aug 24 15:48:18 2014 +0200

    Change ports range in validators and test function

    Current implementation for validating the port number and protocol
    number accepts invalid values. For port number it accepts -1 which is
    invalid, and the 0 which is used as programming technique for specifying
    system-allocated (dynamic) ports. For protocol number it accepts only
    one invalid value which is -1.

    Proposed solution changes the range of:
    - valid port numbers from <-1, 65535> to <1, 65535>
    - valid protocol numbers from <-1, 255> to <0, 255>

    Co-Authored-By: Wlodzimierz Borkowski <email address hidden>
    Co-Authored-By: Kamil Rykowski <email address hidden>

    Closes-Bug: 1329571
    Closes-Bug: 1431367
    Change-Id: I2dc83b611deaa0cc91d586dad1c01d8de91d1957

Changed in horizon:
status: In Progress → Fix Committed
Changed in horizon:
importance: Undecided → Low
milestone: none → mitaka-1
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 9.0.0.0b1

This issue was fixed in the openstack/horizon 9.0.0.0b1 development milestone.

Changed in horizon:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.