Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpclib loads invalid documents #50017

Closed
exarkun mannequin opened this issue Apr 16, 2009 · 6 comments
Closed

xmlrpclib loads invalid documents #50017

exarkun mannequin opened this issue Apr 16, 2009 · 6 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@exarkun
Copy link
Mannequin

exarkun mannequin commented Apr 16, 2009

BPO 5767
Nosy @birkenfeld, @rhettinger
Files
  • xmlrpclib.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-06-04.09:01:29.191>
    created_at = <Date 2009-04-16.00:19:54.909>
    labels = ['type-bug', 'library']
    title = 'xmlrpclib loads invalid documents'
    updated_at = <Date 2012-05-24.13:23:48.060>
    user = 'https://bugs.python.org/exarkun'

    bugs.python.org fields:

    activity = <Date 2012-05-24.13:23:48.060>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-06-04.09:01:29.191>
    closer = 'georg.brandl'
    components = ['Library (Lib)']
    creation = <Date 2009-04-16.00:19:54.909>
    creator = 'exarkun'
    dependencies = []
    files = ['14023']
    hgrepos = []
    issue_num = 5767
    keywords = ['patch']
    message_count = 6.0
    messages = ['86010', '86033', '86034', '86036', '88127', '88868']
    nosy_count = 4.0
    nosy_names = ['effbot', 'georg.brandl', 'rhettinger', 'exarkun']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue5767'
    versions = ['Python 2.7']

    @exarkun
    Copy link
    Mannequin Author

    exarkun mannequin commented Apr 16, 2009

    Prior versions of xmlrpclib.loads would raise an exception when passed
    malformed documents:

    exarkun@bigdog24:~/_trial_temp$ python2.4 -c 'from xmlrpclib import
    loads; loads("\x00\n<methodResponse>\n <params>\n  <param>\n  </param>\n
    </params>\n</methodResponse>\n")'
    Traceback (most recent call last):
      File "<string>", line 1, in ?
      File "/usr/lib/python2.4/xmlrpclib.py", line 1079, in loads
        p.feed(data)
      File "/usr/lib/python2.4/xmlrpclib.py", line 527, in feed
        self._parser.Parse(data, 0)
    xml.parsers.expat.ExpatError: not well-formed (invalid token): line 2,
    column 0

    However, as of the most recent Python 2.5 and Python 2.6 point releases,
    this is no longer the case:

    exarkun@bigdog24:/_trial_temp$ python2.5 -c 'from xmlrpclib import
    loads; loads("\x00\n<methodResponse>\n <params>\n <param>\n </param>\n
    </params>\n</methodResponse>\n")'
    exarkun@bigdog24:
    /_trial_temp$ python2.6 -c 'from xmlrpclib import
    loads; loads("\x00\n<methodResponse>\n <params>\n <param>\n </param>\n
    </params>\n</methodResponse>\n")'
    exarkun@bigdog24:~/_trial_temp$

    Previous versions of Python 2.5 and Python 2.6 did not exhibit this
    misbehavior.

    @exarkun exarkun mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 16, 2009
    @exarkun
    Copy link
    Mannequin Author

    exarkun mannequin commented Apr 16, 2009

    This actually appears to be an issue with the sgmlop-based parser, not
    the expat-based parser. After removing sgmlop, the exception-raising
    behavior is restored.

    Perhaps this bug should be closed as invalid, then. Only, I wonder if
    this is the right bug tracker to use for sgmlop, or if it has one
    somewhere else?

    @effbot
    Copy link
    Mannequin

    effbot mannequin commented Apr 16, 2009

    sgmlop doesn't do much validation; to quote the homepage: "[sgmlop] is
    tolerant, and happily accepts XML-like data that are not well-formed. If
    you need strictness, use another parser."

    But given that Python ships with cElementTree these days, and
    cElementTree's XMLParser (based on expat) is faster than both sgmlop and
    pyexpat, maybe it's time to remove sgmlop support from xmlrpclib...

    @rhettinger
    Copy link
    Contributor

    maybe it's time to remove sgmlop support from xmlrpclib...

    +1

    @exarkun
    Copy link
    Mannequin Author

    exarkun mannequin commented May 20, 2009

    Here's a patch which removes sgmlop support from xmlrpclib.

    @birkenfeld
    Copy link
    Member

    Applied in r73201, r73202.

    @PhilDaintree PhilDaintree mannequin changed the title xmlrpclib loads invalid documents xmlrpclib expat May 24, 2012
    @amauryfa amauryfa changed the title xmlrpclib expat xmlrpclib loads invalid documents May 24, 2012
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants