Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8db356

Browse files
committed
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2)
1 parent 1f2799b commit e8db356

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Modules/mmapmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
13451345
if (size == 0) {
13461346
PyErr_SetString(PyExc_ValueError,
13471347
"cannot mmap an empty file");
1348+
Py_DECREF(m_obj);
13481349
return NULL;
13491350
}
13501351
if (offset >= size) {

0 commit comments

Comments
 (0)