check windows fd validity (closes #16992)

This commit is contained in:
Benjamin Peterson 2013-01-18 00:10:24 -05:00
parent fc4aa76d59
commit c68a4a048c
3 changed files with 13 additions and 3 deletions

View file

@ -427,7 +427,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
return NULL;
}
#endif
if (fd != -1 && fstat(fd, &buf) != 0) {
if (fd != -1 && (!_PyVerify_fd(fd) || fstat(fd, &buf) != 0)) {
PyErr_SetString(PyExc_ValueError, "invalid fd");
return NULL;
}