PyUnicode_FSDecoder() ensures that the decoded string is ready

This commit is contained in:
Victor Stinner 2011-10-27 01:56:33 +02:00
parent 7592d0513e
commit 065836ec9c
1 changed files with 4 additions and 0 deletions

View File

@ -3318,6 +3318,10 @@ PyUnicode_FSDecoder(PyObject* arg, void* addr)
return 0;
}
}
if (PyUnicode_READY(output) < 0) {
Py_DECREF(output);
return 0;
}
if (findchar(PyUnicode_DATA(output), PyUnicode_KIND(output),
PyUnicode_GET_LENGTH(output), 0, 1) >= 0) {
PyErr_SetString(PyExc_TypeError, "embedded NUL character");