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
1fe9f968
Kaydet (Commit)
1fe9f968
authored
Mar 28, 2007
tarafından
Facundo Batista
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
üst
b20c5002
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
test_socket.py
Lib/test/test_socket.py
+7
-0
socketmodule.c
Modules/socketmodule.c
+8
-2
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
1fe9f968
...
...
@@ -597,6 +597,13 @@ class BasicUDPTest(ThreadedUDPSocketTest):
def
_testRecvFrom
(
self
):
self
.
cli
.
sendto
(
MSG
,
0
,
(
HOST
,
PORT
))
def
testRecvFromNegative
(
self
):
# Negative lengths passed to recvfrom should give ValueError.
self
.
assertRaises
(
ValueError
,
self
.
serv
.
recvfrom
,
-
1
)
def
_testRecvFromNegative
(
self
):
self
.
cli
.
sendto
(
MSG
,
0
,
(
HOST
,
PORT
))
class
TCPCloserTest
(
ThreadedTCPSocketTest
):
def
testClose
(
self
):
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
1fe9f968
...
...
@@ -2391,7 +2391,7 @@ sock_recv_into(PySocketSockObject *s, PyObject *args, PyObject *kwds)
if
(
recvlen
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"negative buffersize in recv"
);
"negative buffersize in recv
_into
"
);
return
NULL
;
}
if
(
recvlen
==
0
)
{
...
...
@@ -2507,6 +2507,12 @@ sock_recvfrom(PySocketSockObject *s, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"i|i:recvfrom"
,
&
recvlen
,
&
flags
))
return
NULL
;
if
(
recvlen
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"negative buffersize in recvfrom"
);
return
NULL
;
}
buf
=
PyString_FromStringAndSize
((
char
*
)
0
,
recvlen
);
if
(
buf
==
NULL
)
return
NULL
;
...
...
@@ -2560,7 +2566,7 @@ sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds)
if
(
recvlen
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"negative buffersize in recv"
);
"negative buffersize in recv
from_into
"
);
return
NULL
;
}
if
(
recvlen
==
0
)
{
...
...
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