diff options
author | Eli Bendersky <eliben@gmail.com> | 2013-11-28 14:31:58 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2013-11-28 14:31:58 (GMT) |
commit | 5dd40e555b625c592b8391df84b36215204db4df (patch) | |
tree | 116f05746ecab2ff93071539ba8b926b682410c2 /Modules/_elementtree.c | |
parent | c303cfdb8a1e23faf677262d7bc14c6ef6b2251a (diff) | |
download | cpython-5dd40e555b625c592b8391df84b36215204db4df.zip cpython-5dd40e555b625c592b8391df84b36215204db4df.tar.gz cpython-5dd40e555b625c592b8391df84b36215204db4df.tar.bz2 |
Issue #19815: Fix segfault when parsing empty namespace declaration.
Based on patches by Christian Heimes and Vajrasky Kok
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 9bdc4c7..7e01352 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2997,7 +2997,10 @@ expat_start_ns_handler(XMLParserObject* self, const XML_Char* prefix, PyObject* sprefix = NULL; PyObject* suri = NULL; - suri = PyUnicode_DecodeUTF8(uri, strlen(uri), "strict"); + if (uri) + suri = PyUnicode_DecodeUTF8(uri, strlen(uri), "strict"); + else + suri = PyUnicode_FromString(""); if (!suri) return; |