[Python-checkins] r79276 - python/branches/py3k/Modules/_elementtree.c

victor.stinner python-checkins at python.org
Mon Mar 22 13:11:44 CET 2010


Author: victor.stinner
Date: Mon Mar 22 13:11:44 2010
New Revision: 79276

Log:
Fix a crash in _elementtree related to lone unicode surrogates.

Fix a segfault on:

   >>> import _elementtree
   >>> _elementtree.iterparse('/bin/sh', ("\uDC80", "\ud808\udf45"))


Modified:
   python/branches/py3k/Modules/_elementtree.c

Modified: python/branches/py3k/Modules/_elementtree.c
==============================================================================
--- python/branches/py3k/Modules/_elementtree.c	(original)
+++ python/branches/py3k/Modules/_elementtree.c	Mon Mar 22 13:11:44 2010
@@ -2734,6 +2734,8 @@
         char* event;
         if (PyUnicode_Check(item)) {
             event = _PyUnicode_AsString(item);
+            if (event == NULL)
+                goto error;
         } else if (PyBytes_Check(item))
             event = PyBytes_AS_STRING(item);
         else {


More information about the Python-checkins mailing list