Redundant UTF-8 check

Bug #1704539 reported by junboli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
junboli

Bug Description

In the file proxy/server.py, handle_request method does UTF-8 check twice, see code bellow:

try:
    if not check_utf8(req.path_info):
        self.logger.increment('errors')
        return HTTPPreconditionFailed(
            request=req, body='Invalid UTF8 or contains NULL')
except UnicodeError:
    self.logger.increment('errors')
    return HTTPPreconditionFailed(
        request=req, body='Invalid UTF8 or contains NULL')

try:
    controller, path_parts = self.get_controller(req)
    p = req.path_info
    if isinstance(p, six.text_type):
        p = p.encode('utf-8')
except APIVersionError:
    self.logger.increment('errors')
    return HTTPBadRequest(request=req)

p = p.encode('utf-8') does the second encode while check_utf8 has done it.

junboli (junboli)
Changed in swift:
assignee: nobody → junboli (junboli)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.openstack.org/484107

Changed in swift:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/484107
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=e1a2c28ec3b7499180a9f52a98dc2a2f02a1baf7
Submitter: Jenkins
Branch: master

commit e1a2c28ec3b7499180a9f52a98dc2a2f02a1baf7
Author: junboli <email address hidden>
Date: Sat Jul 15 17:05:15 2017 +0800

    Fix redundant UTF-8 check

    In the file proxy/server.py, handle_request method does UTF-8
    check twice. This patch is to fix it.

    Change-Id: I6db742bce6fa4fa9e935b15460037e0ec90e9373
    Closes-Bug: #1704539

Changed in swift:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.15.0

This issue was fixed in the openstack/swift 2.15.0 release.

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.