[Patches] [ python-Patches-1173998 ] Python crashes in pyexpat.c if malformed XML is parsed

SourceForge.net noreply at sourceforge.net
Tue Jan 10 08:14:04 CET 2006


Patches item #1173998, was opened at 2005-03-31 02:59
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1173998&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: pdecat (pdecat)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: Python crashes in pyexpat.c if malformed XML is parsed

Initial Comment:
If a malformed XML file (containing non unicode
characters) is parsed with pyexpat, python crashes.

Most details on request.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-01-09 23:14

Message:
Logged In: YES 
user_id=33168

A similar patch was commited to pyexpat.c in 39631 from
Patch #1309009.  Thanks.

----------------------------------------------------------------------

Comment By: pdecat (pdecat)
Date: 2005-08-23 03:29

Message:
Logged In: YES 
user_id=1210681

Sorry, I don't have the malformed XML file anymore. I've
tried and failed to reproduce the problem by hand.

The ParsedXML product lets expat determine the encoding
itself : 
    def createParser(self):
        """Create a new parser object."""
        return expat.ParserCreate()

If you have a look at my patch, it's a real simple one-liner
(ok two ;) that checks the return value of the
STRING_CONV_FUNC is not NULL before using it.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2005-08-22 20:59

Message:
Logged In: YES 
user_id=3066

I realize this has sat too long; sorry.

Can you send an example XML file for which this crashes for you?

Do you let Expat determine and handle the encoding itself,
or do you override the detected encoding when you create the
parser?


----------------------------------------------------------------------

Comment By: pdecat (pdecat)
Date: 2005-03-31 05:00

Message:
Logged In: YES 
user_id=1210681

STRING_CONV_FUNC returns NULL if the string is contains
non-ascii and non-unicode characters.

----------------------------------------------------------------------

Comment By: pdecat (pdecat)
Date: 2005-03-31 04:18

Message:
Logged In: YES 
user_id=1210681

Maybe security related, as it can lead to denial of service:
it crashes a Zope server using the ParsedXML product simply
by uploading a malformed XML file.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1173998&group_id=5470


More information about the Patches mailing list