Fix a crash in _elementtree related to lone unicode surrogates.
Fix a segfault on: >>> import _elementtree >>> _elementtree.iterparse('/bin/sh', ("\uDC80", "\ud808\udf45"))
This commit is contained in:
parent
eab4b4c784
commit
0477bf3a93
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue