[Python-checkins] cpython: Closes #15737: Fix potential NULL dereference in zipimport.c.

stefan.krah python-checkins at python.org
Mon Aug 20 14:18:46 CEST 2012


http://hg.python.org/cpython/rev/c89fe7dc22ee
changeset:   78669:c89fe7dc22ee
user:        Stefan Krah <skrah at bytereef.org>
date:        Mon Aug 20 14:14:49 2012 +0200
summary:
  Closes #15737: Fix potential NULL dereference in zipimport.c.

files:
  Modules/zipimport.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -947,8 +947,6 @@
         else
             charset = "cp437";
         nameobj = PyUnicode_Decode(name, name_size, charset, NULL);
-        if (PyUnicode_READY(nameobj) == -1)
-            goto error;
         if (nameobj == NULL) {
             if (bootstrap)
                 PyErr_Format(PyExc_NotImplementedError,
@@ -957,6 +955,8 @@
                     PY_MAJOR_VERSION, PY_MINOR_VERSION);
             goto error;
         }
+        if (PyUnicode_READY(nameobj) == -1)
+            goto error;
         path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj);
         if (path == NULL)
             goto error;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list