summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2011-08-28 16:10:27 (GMT)
committerCharles-François Natali <neologix@free.fr>2011-08-28 16:10:27 (GMT)
commitac7e9e058d8da18d0002f2b9456900c34a13e463 (patch)
tree8b3729f41abc4afd6e0c682f01f6d80b3a09604c /Modules/selectmodule.c
parent44c6ef50af9980f33f6373440f0afc9cfa800c86 (diff)
parentaa26b275034c07784c4d64e9a2bc26c742577327 (diff)
downloadcpython-ac7e9e058d8da18d0002f2b9456900c34a13e463.zip
cpython-ac7e9e058d8da18d0002f2b9456900c34a13e463.tar.gz
cpython-ac7e9e058d8da18d0002f2b9456900c34a13e463.tar.bz2
Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 20f23d9..e594b51 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -110,7 +110,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
#if defined(_MSC_VER)
max = 0; /* not used for Win32 */
#else /* !_MSC_VER */
- if (v < 0 || v >= FD_SETSIZE) {
+ if (!_PyIsSelectable_fd(v)) {
PyErr_SetString(PyExc_ValueError,
"filedescriptor out of range in select()");
goto finally;
@@ -160,13 +160,6 @@ set2list(fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
for (j = 0; fd2obj[j].sentinel >= 0; j++) {
fd = fd2obj[j].fd;
if (FD_ISSET(fd, set)) {
-#ifndef _MSC_VER
- if (fd > FD_SETSIZE) {
- PyErr_SetString(PyExc_SystemError,
- "filedescriptor out of range returned in select()");
- goto finally;
- }
-#endif
o = fd2obj[j].obj;
fd2obj[j].obj = NULL;
/* transfer ownership */