From 065836ec9c76ed7134562438f5a760a5e20b27e4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 27 Oct 2011 01:56:33 +0200 Subject: [PATCH] PyUnicode_FSDecoder() ensures that the decoded string is ready --- Objects/unicodeobject.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ec4aed6e2d..ef2839a125 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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"); -- 2.40.0