]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix marshal reader for Unicode strings: handle
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 8 Jul 2013 20:23:32 +0000 (22:23 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 8 Jul 2013 20:23:32 +0000 (22:23 +0200)
PyUnicode_DecodeUTF8() failure (ex: MemoryError).

Python/marshal.c

index e519fc9bfa89b3df9a7c8fba397dd923abd14775..e97de597916c7cb17798abc0ca4b4c6cbb1b79ab 100644 (file)
@@ -998,6 +998,10 @@ r_object(RFILE *p)
         else {
             v = PyUnicode_New(0, 0);
         }
+        if (v == NULL) {
+            retval = NULL;
+            break;
+        }
         if (type == TYPE_INTERNED)
             PyUnicode_InternInPlace(&v);
         retval = v;