diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-09-30 04:46:49 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-09-30 04:46:49 (GMT) |
commit | 484d9a409a94e719329b41edaed38c1b16b8de7d (patch) | |
tree | a95cc808b2ce9df46b41a6ee8b45fb90ef00a68e /Modules | |
parent | aa93517de8b5e2b41644a22ae81ddec4f5d72991 (diff) | |
download | cpython-484d9a409a94e719329b41edaed38c1b16b8de7d.zip cpython-484d9a409a94e719329b41edaed38c1b16b8de7d.tar.gz cpython-484d9a409a94e719329b41edaed38c1b16b8de7d.tar.bz2 |
Patch #1309009, Fix segfault in pyexpat when the XML document is
in latin_1, but Python incorrectly assumes it is in UTF-8 format
Will backport.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/pyexpat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index e6c14f8..438f760 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -417,6 +417,9 @@ string_intern(xmlparseobject *self, const char* str) { PyObject *result = STRING_CONV_FUNC(str); PyObject *value; + /* result can be NULL if the unicode conversion failed. */ + if (!result) + return result; if (!self->intern) return result; value = PyDict_GetItem(self->intern, result); @@ -572,7 +575,9 @@ my_StartElementHandler(void *userData, Py_DECREF(v); } } - args = Py_BuildValue("(NN)", string_intern(self, name), container); + args = string_intern(self, name); + if (args != NULL) + args = Py_BuildValue("(NN)", args, container); if (args == NULL) { Py_DECREF(container); return; |