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
a92cc91e
Kaydet (Commit)
a92cc91e
authored
Ara 14, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17919: Fixed integer overflow in the eventmask parameter.
üst
91b88c8d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
+35
-13
test_poll.py
Lib/test/test_poll.py
+8
-5
NEWS
Misc/NEWS
+2
-1
selectmodule.c
Modules/selectmodule.c
+25
-7
No files found.
Lib/test/test_poll.py
Dosyayı görüntüle @
a92cc91e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
os
import
os
import
random
import
random
import
select
import
select
import
_testcapi
from
_testcapi
import
USHRT_MAX
,
INT_MAX
,
UINT_MAX
try
:
try
:
import
threading
import
threading
except
ImportError
:
except
ImportError
:
...
@@ -159,10 +159,13 @@ class PollTests(unittest.TestCase):
...
@@ -159,10 +159,13 @@ class PollTests(unittest.TestCase):
if
x
!=
5
:
if
x
!=
5
:
self
.
fail
(
'Overflow must have occurred'
)
self
.
fail
(
'Overflow must have occurred'
)
pollster
=
select
.
poll
()
# Issues #15989, #17919
# Issue 15989
self
.
assertRaises
(
OverflowError
,
pollster
.
register
,
0
,
-
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
poll
,
_testcapi
.
INT_MAX
+
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
register
,
0
,
USHRT_MAX
+
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
poll
,
_testcapi
.
UINT_MAX
+
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
modify
,
1
,
-
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
modify
,
1
,
USHRT_MAX
+
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
poll
,
INT_MAX
+
1
)
self
.
assertRaises
(
OverflowError
,
pollster
.
poll
,
UINT_MAX
+
1
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
@reap_threads
@reap_threads
...
...
Misc/NEWS
Dosyayı görüntüle @
a92cc91e
...
@@ -23,7 +23,8 @@ Core and Builtins
...
@@ -23,7 +23,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #17919: select.poll.poll() again works with poll.POLLNVAL on AIX.
- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX.
Fixed integer overflow in the eventmask parameter.
- Issue #17200: telnetlib'
s
read_until
and
expect
timeout
was
broken
by
the
- Issue #17200: telnetlib'
s
read_until
and
expect
timeout
was
broken
by
the
fix
to
Issue
#
14635
in
Python
2.7.4
to
be
interpreted
as
milliseconds
fix
to
Issue
#
14635
in
Python
2.7.4
to
be
interpreted
as
milliseconds
...
...
Modules/selectmodule.c
Dosyayı görüntüle @
a92cc91e
...
@@ -347,7 +347,7 @@ update_ufd_array(pollObject *self)
...
@@ -347,7 +347,7 @@ update_ufd_array(pollObject *self)
assert
(
i
<
self
->
ufd_len
);
assert
(
i
<
self
->
ufd_len
);
/* Never overflow */
/* Never overflow */
self
->
ufds
[
i
].
fd
=
(
int
)
PyInt_AsLong
(
key
);
self
->
ufds
[
i
].
fd
=
(
int
)
PyInt_AsLong
(
key
);
self
->
ufds
[
i
].
events
=
(
short
)
PyInt_AsLong
(
value
);
self
->
ufds
[
i
].
events
=
(
short
)
(
unsigned
short
)
PyInt_AsLong
(
value
);
i
++
;
i
++
;
}
}
assert
(
i
==
self
->
ufd_len
);
assert
(
i
==
self
->
ufd_len
);
...
@@ -355,6 +355,24 @@ update_ufd_array(pollObject *self)
...
@@ -355,6 +355,24 @@ update_ufd_array(pollObject *self)
return
1
;
return
1
;
}
}
static
int
ushort_converter
(
PyObject
*
obj
,
void
*
ptr
)
{
unsigned
long
uval
;
uval
=
PyLong_AsUnsignedLong
(
obj
);
if
(
uval
==
(
unsigned
long
)
-
1
&&
PyErr_Occurred
())
return
0
;
if
(
uval
>
USHRT_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"Python int too large for C unsigned short"
);
return
0
;
}
*
(
unsigned
short
*
)
ptr
=
Py_SAFE_DOWNCAST
(
uval
,
unsigned
long
,
unsigned
short
);
return
1
;
}
PyDoc_STRVAR
(
poll_register_doc
,
PyDoc_STRVAR
(
poll_register_doc
,
"register(fd [, eventmask] ) -> None
\n\n
\
"register(fd [, eventmask] ) -> None
\n\n
\
Register a file descriptor with the polling object.
\n
\
Register a file descriptor with the polling object.
\n
\
...
@@ -366,12 +384,12 @@ static PyObject *
...
@@ -366,12 +384,12 @@ static PyObject *
poll_register
(
pollObject
*
self
,
PyObject
*
args
)
poll_register
(
pollObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
o
,
*
key
,
*
value
;
PyObject
*
o
,
*
key
,
*
value
;
int
fd
,
events
=
POLLIN
|
POLLPRI
|
POLLOUT
;
int
fd
;
unsigned
short
events
=
POLLIN
|
POLLPRI
|
POLLOUT
;
int
err
;
int
err
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|
i:register"
,
&
o
,
&
events
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"O|
O&:register"
,
&
o
,
ushort_converter
,
&
events
))
return
NULL
;
return
NULL
;
}
fd
=
PyObject_AsFileDescriptor
(
o
);
fd
=
PyObject_AsFileDescriptor
(
o
);
if
(
fd
==
-
1
)
return
NULL
;
if
(
fd
==
-
1
)
return
NULL
;
...
@@ -409,12 +427,12 @@ static PyObject *
...
@@ -409,12 +427,12 @@ static PyObject *
poll_modify
(
pollObject
*
self
,
PyObject
*
args
)
poll_modify
(
pollObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
o
,
*
key
,
*
value
;
PyObject
*
o
,
*
key
,
*
value
;
int
fd
,
events
;
int
fd
;
unsigned
short
events
;
int
err
;
int
err
;
if
(
!
PyArg_ParseTuple
(
args
,
"O
i:modify"
,
&
o
,
&
events
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"O
O&:modify"
,
&
o
,
ushort_converter
,
&
events
))
return
NULL
;
return
NULL
;
}
fd
=
PyObject_AsFileDescriptor
(
o
);
fd
=
PyObject_AsFileDescriptor
(
o
);
if
(
fd
==
-
1
)
return
NULL
;
if
(
fd
==
-
1
)
return
NULL
;
...
...
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