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 e23613e..b993fdf 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1342,6 +1342,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"); |