diff options
Diffstat (limited to 'Modules')
-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 9714ddf..b170b38 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1203,6 +1203,11 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) 1); */ if (fileno != -1 && fileno != 0) { + /* Ensure that fileno is within the CRT's valid range */ + if (_PyVerify_fd(fileno) == 0) { + PyErr_SetFromErrno(mmap_module_error); + return NULL; + } fh = (HANDLE)_get_osfhandle(fileno); if (fh==(HANDLE)-1) { PyErr_SetFromErrno(mmap_module_error); |