From: Stefan Krah Date: Mon, 20 Aug 2012 12:14:49 +0000 (+0200) Subject: Closes #15737: Fix potential NULL dereference in zipimport.c. X-Git-Tag: v3.3.0rc1~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=000fde9651079209d5e4688c70099e326f2a57f9;p=python Closes #15737: Fix potential NULL dereference in zipimport.c. --- diff --git a/Modules/zipimport.c b/Modules/zipimport.c index ac8dd09615..12bfe233fc 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -947,8 +947,6 @@ read_directory(PyObject *archive) 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 @@ read_directory(PyObject *archive) 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;