diff options
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r-- | Modules/mmapmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 0f22d49..3e20934 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1364,6 +1364,11 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) } size = (((PY_LONG_LONG) high) << 32) + low; + if (size == 0) { + PyErr_SetString(PyExc_ValueError, + "cannot mmap an empty file"); + return NULL; + } if (offset >= size) { PyErr_SetString(PyExc_ValueError, "mmap offset is greater than file size"); |