diff options
author | Brian Curtin <brian.curtin@gmail.com> | 2010-08-01 15:44:11 (GMT) |
---|---|---|
committer | Brian Curtin <brian.curtin@gmail.com> | 2010-08-01 15:44:11 (GMT) |
commit | 686ee4fd3db413b24c49e5a6331d3ba5fb5d9b05 (patch) | |
tree | 3c14ba08916241449d101431e058972839ced33c /Modules/mmapmodule.c | |
parent | fc070313ddc6868b3679ee8d8e59e2e6bfb12406 (diff) | |
download | cpython-686ee4fd3db413b24c49e5a6331d3ba5fb5d9b05.zip cpython-686ee4fd3db413b24c49e5a6331d3ba5fb5d9b05.tar.gz cpython-686ee4fd3db413b24c49e5a6331d3ba5fb5d9b05.tar.bz2 |
Merged revisions 83407 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83407 | brian.curtin | 2010-08-01 10:26:26 -0500 (Sun, 01 Aug 2010) | 3 lines
Fix #8105. Add validation to mmap.mmap so invalid file descriptors
don't cause a crash on Windows.
........
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 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); |