mirror of https://github.com/python/cpython
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2)
This commit is contained in:
parent
20f0ea1f61
commit
8e03b4cae0
|
@ -1391,6 +1391,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"cannot mmap an empty file");
|
"cannot mmap an empty file");
|
||||||
|
Py_DECREF(m_obj);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (offset >= size) {
|
if (offset >= size) {
|
||||||
|
|
Loading…
Reference in New Issue