Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is

greater than FD_SETSIZE.
This commit is contained in:
Charles-François Natali 2011-08-28 17:51:43 +02:00
parent 524148ad7a
commit aa26b27503
6 changed files with 21 additions and 19 deletions

View file

@ -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 */