summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-03-22 12:11:44 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-03-22 12:11:44 (GMT)
commit0477bf3a934b9e959ce4a64f25ce24310797d50e (patch)
tree850fd66b79bc86c43cf1d9a2856c41c757a35cbe /Modules/_elementtree.c
parenteab4b4c784c4351e4b3ea7ead277180d88293f23 (diff)
downloadcpython-0477bf3a934b9e959ce4a64f25ce24310797d50e.zip
cpython-0477bf3a934b9e959ce4a64f25ce24310797d50e.tar.gz
cpython-0477bf3a934b9e959ce4a64f25ce24310797d50e.tar.bz2
Fix a crash in _elementtree related to lone unicode surrogates.
Fix a segfault on: >>> import _elementtree >>> _elementtree.iterparse('/bin/sh', ("\uDC80", "\ud808\udf45"))
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 88374cc..2fad8e2 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -2734,6 +2734,8 @@ xmlparser_setevents(XMLParserObject* self, PyObject* args)
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 {