]> granicus.if.org Git - python/commitdiff
PyUnicode_FSDecoder() ensures that the decoded string is ready
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 26 Oct 2011 23:56:33 +0000 (01:56 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 26 Oct 2011 23:56:33 +0000 (01:56 +0200)
Objects/unicodeobject.c

index ec4aed6e2df733d58630ccf1b7a201610c0d7930..ef2839a125a75da491cfb38f6400664d8e9cb976 100644 (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");