Closes #15737: Fix potential NULL dereference in zipimport.c.
This commit is contained in:
parent
6adf2433e4
commit
000fde9651
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue