Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fda7b379
Kaydet (Commit)
fda7b379
authored
Agu 28, 2011
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
üst
bbabbae1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
19 deletions
+23
-19
fileobject.h
Include/fileobject.h
+9
-0
NEWS
Misc/NEWS
+3
-0
_ssl.c
Modules/_ssl.c
+1
-3
ossaudiodev.c
Modules/ossaudiodev.c
+5
-0
selectmodule.c
Modules/selectmodule.c
+1
-8
socketmodule.c
Modules/socketmodule.c
+4
-8
No files found.
Include/fileobject.h
Dosyayı görüntüle @
fda7b379
...
@@ -84,6 +84,15 @@ int _PyVerify_fd(int fd);
...
@@ -84,6 +84,15 @@ int _PyVerify_fd(int fd);
#define _PyVerify_fd(A) (1)
/* dummy */
#define _PyVerify_fd(A) (1)
/* dummy */
#endif
#endif
#ifdef HAVE_SELECT
/* A routine to check if a file descriptor can be select()-ed. */
#ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
#define _PyIsSelectable_fd(FD) (1)
#else
#define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
#endif
#endif
/* HAVE_SELECT */
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
Misc/NEWS
Dosyayı görüntüle @
fda7b379
...
@@ -40,6 +40,9 @@ Core and Builtins
...
@@ -40,6 +40,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
- Issue #12839: Fix crash in zlib module due to version mismatch.
- Issue #12839: Fix crash in zlib module due to version mismatch.
Fix by Richard M. Tew.
Fix by Richard M. Tew.
...
...
Modules/_ssl.c
Dosyayı görüntüle @
fda7b379
...
@@ -1145,10 +1145,8 @@ check_socket_and_wait_for_timeout(PySocketSockObject *s, int writing)
...
@@ -1145,10 +1145,8 @@ check_socket_and_wait_for_timeout(PySocketSockObject *s, int writing)
#endif
#endif
/* Guard against socket too large for select*/
/* Guard against socket too large for select*/
#ifndef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
if
(
!
_PyIsSelectable_fd
(
s
->
sock_fd
))
if
(
s
->
sock_fd
>=
FD_SETSIZE
)
return
SOCKET_TOO_LARGE_FOR_SELECT
;
return
SOCKET_TOO_LARGE_FOR_SELECT
;
#endif
/* Construct the arguments to select */
/* Construct the arguments to select */
tv
.
tv_sec
=
(
int
)
s
->
sock_timeout
;
tv
.
tv_sec
=
(
int
)
s
->
sock_timeout
;
...
...
Modules/ossaudiodev.c
Dosyayı görüntüle @
fda7b379
...
@@ -425,6 +425,11 @@ oss_writeall(oss_audio_t *self, PyObject *args)
...
@@ -425,6 +425,11 @@ oss_writeall(oss_audio_t *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"s#:write"
,
&
cp
,
&
size
))
if
(
!
PyArg_ParseTuple
(
args
,
"s#:write"
,
&
cp
,
&
size
))
return
NULL
;
return
NULL
;
if
(
!
_PyIsSelectable_fd
(
self
->
fd
))
{
PyErr_SetString
(
PyExc_ValueError
,
"file descriptor out of range for select"
);
return
NULL
;
}
/* use select to wait for audio device to be available */
/* use select to wait for audio device to be available */
FD_ZERO
(
&
write_set_fds
);
FD_ZERO
(
&
write_set_fds
);
FD_SET
(
self
->
fd
,
&
write_set_fds
);
FD_SET
(
self
->
fd
,
&
write_set_fds
);
...
...
Modules/selectmodule.c
Dosyayı görüntüle @
fda7b379
...
@@ -114,7 +114,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
...
@@ -114,7 +114,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
#if defined(_MSC_VER)
#if defined(_MSC_VER)
max
=
0
;
/* not used for Win32 */
max
=
0
;
/* not used for Win32 */
#else
/* !_MSC_VER */
#else
/* !_MSC_VER */
if
(
v
<
0
||
v
>=
FD_SETSIZE
)
{
if
(
!
_PyIsSelectable_fd
(
v
)
)
{
PyErr_SetString
(
PyExc_ValueError
,
PyErr_SetString
(
PyExc_ValueError
,
"filedescriptor out of range in select()"
);
"filedescriptor out of range in select()"
);
goto
finally
;
goto
finally
;
...
@@ -164,13 +164,6 @@ set2list(fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
...
@@ -164,13 +164,6 @@ set2list(fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
for
(
j
=
0
;
fd2obj
[
j
].
sentinel
>=
0
;
j
++
)
{
for
(
j
=
0
;
fd2obj
[
j
].
sentinel
>=
0
;
j
++
)
{
fd
=
fd2obj
[
j
].
fd
;
fd
=
fd2obj
[
j
].
fd
;
if
(
FD_ISSET
(
fd
,
set
))
{
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
;
o
=
fd2obj
[
j
].
obj
;
fd2obj
[
j
].
obj
=
NULL
;
fd2obj
[
j
].
obj
=
NULL
;
/* transfer ownership */
/* transfer ownership */
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
fda7b379
...
@@ -456,18 +456,14 @@ static PyTypeObject sock_type;
...
@@ -456,18 +456,14 @@ static PyTypeObject sock_type;
#include <sys/poll.h>
#include <sys/poll.h>
#endif
#endif
#ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
#ifdef HAVE_POLL
/* Platform can select file descriptors beyond FD_SETSIZE */
#define IS_SELECTABLE(s) 1
#elif defined(HAVE_POLL)
/* Instead of select(), we'll use poll() since poll() works on any fd. */
/* Instead of select(), we'll use poll() since poll() works on any fd. */
#define IS_SELECTABLE(s) 1
#define IS_SELECTABLE(s) 1
/* Can we call select() with this socket without a buffer overrun? */
/* Can we call select() with this socket without a buffer overrun? */
#else
#else
/* POSIX says selecting file descriptors beyond FD_SETSIZE
/* If there's no timeout left, we don't have to call select, so it's a safe,
has undefined behaviour. If there's no timeout left, we don't have to
* little white lie. */
call select, so it's a safe, little white lie. */
#define IS_SELECTABLE(s) (_PyIsSelectable_fd((s)->sock_fd) || (s)->sock_timeout <= 0.0)
#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE || s->sock_timeout <= 0.0)
#endif
#endif
static
PyObject
*
static
PyObject
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment