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
41c98a32
Kaydet (Commit)
41c98a32
authored
Eyl 21, 2011
tarafından
Jesus Cea
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Close #13022: _multiprocessing.recvfd() doesn't check that file descriptor was actually received
üst
c78fb33f
4507e645
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+17
-0
NEWS
Misc/NEWS
+3
-0
multiprocessing.c
Modules/_multiprocessing/multiprocessing.c
+11
-0
No files found.
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
41c98a32
...
...
@@ -1689,6 +1689,23 @@ class _TestConnection(BaseTestCase):
with
open
(
test
.
support
.
TESTFN
,
"rb"
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
"bar"
)
@classmethod
def
_send_data_without_fd
(
self
,
conn
):
os
.
write
(
conn
.
fileno
(),
b
"
\0
"
)
@unittest.skipIf
(
sys
.
platform
==
"win32"
,
"doesn't make sense on Windows"
)
def
test_missing_fd_transfer
(
self
):
# Check that exception is raised when received data is not
# accompanied by a file descriptor in ancillary data.
if
self
.
TYPE
!=
'processes'
:
self
.
skipTest
(
"only makes sense with processes"
)
conn
,
child_conn
=
self
.
Pipe
(
duplex
=
True
)
p
=
self
.
Process
(
target
=
self
.
_send_data_without_fd
,
args
=
(
child_conn
,))
p
.
daemon
=
True
p
.
start
()
self
.
assertRaises
(
RuntimeError
,
reduction
.
recv_handle
,
conn
)
p
.
join
()
class
_TestListenerClient
(
BaseTestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
41c98a32
...
...
@@ -1287,6 +1287,9 @@ Tools/Demos
Extension
Modules
-----------------
-
Issue
#
13022
:
Fix
:
_multiprocessing
.
recvfd
()
doesn
't check that
file descriptor was actually received.
- Issue #1172711: Add '
long
long
' support to the array module.
Initial patch by Oren Tirosh and Hirokazu Yamamoto.
...
...
Modules/_multiprocessing/multiprocessing.c
Dosyayı görüntüle @
41c98a32
...
...
@@ -166,6 +166,17 @@ multiprocessing_recvfd(PyObject *self, PyObject *args)
if
(
res
<
0
)
return
PyErr_SetFromErrno
(
PyExc_OSError
);
if
(
msg
.
msg_controllen
<
CMSG_LEN
(
sizeof
(
int
))
||
(
cmsg
=
CMSG_FIRSTHDR
(
&
msg
))
==
NULL
||
cmsg
->
cmsg_level
!=
SOL_SOCKET
||
cmsg
->
cmsg_type
!=
SCM_RIGHTS
||
cmsg
->
cmsg_len
<
CMSG_LEN
(
sizeof
(
int
)))
{
/* If at least one control message is present, there should be
no room for any further data in the buffer. */
PyErr_SetString
(
PyExc_RuntimeError
,
"No file descriptor received"
);
return
NULL
;
}
fd
=
*
(
int
*
)
CMSG_DATA
(
cmsg
);
return
Py_BuildValue
(
"i"
,
fd
);
}
...
...
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