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
9a5b2ad3
Kaydet (Commit)
9a5b2ad3
authored
Ock 19, 2009
tarafından
Jesse Noller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Resolve issue 3321: (segfault) _multiprocessing.Connection() doesn't check handle
üst
273c1d9a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+15
-1
NEWS
Misc/NEWS
+4
-0
connection.h
Modules/_multiprocessing/connection.h
+1
-1
socket_connection.c
Modules/_multiprocessing/socket_connection.c
+13
-1
No files found.
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
9a5b2ad3
...
...
@@ -61,6 +61,8 @@ else:
HAVE_GETVALUE
=
not
getattr
(
_multiprocessing
,
'HAVE_BROKEN_SEM_GETVALUE'
,
False
)
WIN32
=
(
sys
.
platform
==
"win32"
)
#
# Creates a wrapper for a function which records the time it takes to finish
#
...
...
@@ -1682,6 +1684,18 @@ class _TestLogging(BaseTestCase):
logger
.
setLevel
(
level
=
LOG_LEVEL
)
#
# Test to verify handle verification, see issue 3321
#
class
TestInvalidHandle
(
unittest
.
TestCase
):
def
test_invalid_handles
(
self
):
if
WIN32
:
return
conn
=
_multiprocessing
.
Connection
(
44977608
)
self
.
assertRaises
(
IOError
,
conn
.
poll
)
self
.
assertRaises
(
IOError
,
_multiprocessing
.
Connection
,
-
1
)
#
# Functions used to create test cases from the base ones in this module
#
...
...
@@ -1785,7 +1799,7 @@ class OtherTest(unittest.TestCase):
multiprocessing
.
connection
.
answer_challenge
,
_FakeConnection
(),
b
'abc'
)
testcases_other
=
[
OtherTest
]
testcases_other
=
[
OtherTest
,
TestInvalidHandle
]
#
#
...
...
Misc/NEWS
Dosyayı görüntüle @
9a5b2ad3
...
...
@@ -140,6 +140,10 @@ Core and Builtins
Library
-------
- Issue #3321: _multiprocessing.Connection() doesn't check handle; added checks
for *nix machines for negative handles and large int handles. Without this check
it is possible to segfault the interpreter.
- Issue #4449: AssertionError in mp_benchmarks.py, caused by an underlying issue
in sharedctypes.py.
...
...
Modules/_multiprocessing/connection.h
Dosyayı görüntüle @
9a5b2ad3
...
...
@@ -354,7 +354,7 @@ connection_poll(ConnectionObject *self, PyObject *args)
}
Py_BEGIN_ALLOW_THREADS
res
=
conn_poll
(
self
,
timeout
);
res
=
conn_poll
(
self
,
timeout
,
_save
);
Py_END_ALLOW_THREADS
switch
(
res
)
{
...
...
Modules/_multiprocessing/socket_connection.c
Dosyayı görüntüle @
9a5b2ad3
...
...
@@ -153,11 +153,23 @@ conn_recv_string(ConnectionObject *conn, char *buffer,
*/
static
int
conn_poll
(
ConnectionObject
*
conn
,
double
timeout
)
conn_poll
(
ConnectionObject
*
conn
,
double
timeout
,
PyThreadState
*
_save
)
{
int
res
;
fd_set
rfds
;
/*
* Verify the handle, issue 3321. Not required for windows.
*/
#ifndef MS_WINDOWS
if
(((
int
)
conn
->
handle
)
<
0
||
((
int
)
conn
->
handle
)
>=
FD_SETSIZE
)
{
Py_BLOCK_THREADS
PyErr_SetString
(
PyExc_IOError
,
"handle out of range in select()"
);
Py_UNBLOCK_THREADS
return
MP_EXCEPTION_HAS_BEEN_SET
;
}
#endif
FD_ZERO
(
&
rfds
);
FD_SET
((
SOCKET
)
conn
->
handle
,
&
rfds
);
...
...
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