commit | 0049249d63a067aaffbbf3172a6e8cd8c956b643 | [log] [tgz] |
---|---|---|
author | Antoine Pitrou <solipsis@pitrou.net> | Sat Sep 04 20:53:29 2010 +0000 |
committer | Antoine Pitrou <solipsis@pitrou.net> | Sat Sep 04 20:53:29 2010 +0000 |
tree | dcfee8a6bd6e16db18121380d565bdf8278d9ee6 | |
parent | 7d6e076f6d8dd48cfd748b02dad17dbeb0b346a3 [diff] [blame] |
Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file descriptor is provided. Patch by Pascal Chambon.
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index e173fea..166df03 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c
@@ -143,6 +143,9 @@ if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) return NULL; + if (!_PyVerify_fd(fd)) + return PyErr_SetFromErrno(PyExc_IOError); + handle = _get_osfhandle(fd); if (handle == -1) return PyErr_SetFromErrno(PyExc_IOError);