diff options
author | Charles-François Natali <neologix@free.fr> | 2011-08-28 16:10:27 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-08-28 16:10:27 (GMT) |
commit | ac7e9e058d8da18d0002f2b9456900c34a13e463 (patch) | |
tree | 8b3729f41abc4afd6e0c682f01f6d80b3a09604c /Modules/socketmodule.c | |
parent | 44c6ef50af9980f33f6373440f0afc9cfa800c86 (diff) | |
parent | aa26b275034c07784c4d64e9a2bc26c742577327 (diff) | |
download | cpython-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/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 936a68d..f56e9af 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -485,18 +485,14 @@ static PyTypeObject sock_type; #define SOCKLEN_T_LIMIT INT_MAX #endif -#ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE -/* Platform can select file descriptors beyond FD_SETSIZE */ -#define IS_SELECTABLE(s) 1 -#elif defined(HAVE_POLL) +#ifdef HAVE_POLL /* Instead of select(), we'll use poll() since poll() works on any fd. */ #define IS_SELECTABLE(s) 1 /* Can we call select() with this socket without a buffer overrun? */ #else -/* POSIX says selecting file descriptors beyond FD_SETSIZE - has undefined behaviour. If there's no timeout left, we don't have to - call select, so it's a safe, little white lie. */ -#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE || s->sock_timeout <= 0.0) +/* If there's no timeout left, we don't have to call select, so it's a safe, + * little white lie. */ +#define IS_SELECTABLE(s) (_PyIsSelectable_fd((s)->sock_fd) || (s)->sock_timeout <= 0.0) #endif static PyObject* |