Closes #15737: Fix potential NULL dereference in zipimport.c.

This commit is contained in:
Stefan Krah 2012-08-20 14:14:49 +02:00
parent 6adf2433e4
commit 000fde9651
1 changed files with 2 additions and 2 deletions

View File

@ -947,8 +947,6 @@ read_directory(PyObject *archive)
else else
charset = "cp437"; charset = "cp437";
nameobj = PyUnicode_Decode(name, name_size, charset, NULL); nameobj = PyUnicode_Decode(name, name_size, charset, NULL);
if (PyUnicode_READY(nameobj) == -1)
goto error;
if (nameobj == NULL) { if (nameobj == NULL) {
if (bootstrap) if (bootstrap)
PyErr_Format(PyExc_NotImplementedError, PyErr_Format(PyExc_NotImplementedError,
@ -957,6 +955,8 @@ read_directory(PyObject *archive)
PY_MAJOR_VERSION, PY_MINOR_VERSION); PY_MAJOR_VERSION, PY_MINOR_VERSION);
goto error; goto error;
} }
if (PyUnicode_READY(nameobj) == -1)
goto error;
path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj); path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj);
if (path == NULL) if (path == NULL)
goto error; goto error;