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
fb397790
Kaydet (Commit)
fb397790
authored
Eyl 03, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is
set beyond size. Based on patch by John Leitch.
üst
fed0931d
594e54c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
test_memoryio.py
Lib/test/test_memoryio.py
+13
-0
NEWS
Misc/NEWS
+3
-0
bytesio.c
Modules/_io/bytesio.c
+5
-1
No files found.
Lib/test/test_memoryio.py
Dosyayı görüntüle @
fb397790
...
@@ -166,6 +166,10 @@ class MemoryTestMixin:
...
@@ -166,6 +166,10 @@ class MemoryTestMixin:
memio
.
seek
(
0
)
memio
.
seek
(
0
)
self
.
assertEqual
(
memio
.
read
(
None
),
buf
)
self
.
assertEqual
(
memio
.
read
(
None
),
buf
)
self
.
assertRaises
(
TypeError
,
memio
.
read
,
''
)
self
.
assertRaises
(
TypeError
,
memio
.
read
,
''
)
memio
.
seek
(
len
(
buf
)
+
1
)
self
.
assertEqual
(
memio
.
read
(
1
),
self
.
EOF
)
memio
.
seek
(
len
(
buf
)
+
1
)
self
.
assertEqual
(
memio
.
read
(),
self
.
EOF
)
memio
.
close
()
memio
.
close
()
self
.
assertRaises
(
ValueError
,
memio
.
read
)
self
.
assertRaises
(
ValueError
,
memio
.
read
)
...
@@ -185,6 +189,9 @@ class MemoryTestMixin:
...
@@ -185,6 +189,9 @@ class MemoryTestMixin:
self
.
assertEqual
(
memio
.
readline
(
-
1
),
buf
)
self
.
assertEqual
(
memio
.
readline
(
-
1
),
buf
)
memio
.
seek
(
0
)
memio
.
seek
(
0
)
self
.
assertEqual
(
memio
.
readline
(
0
),
self
.
EOF
)
self
.
assertEqual
(
memio
.
readline
(
0
),
self
.
EOF
)
# Issue #24989: Buffer overread
memio
.
seek
(
len
(
buf
)
*
2
+
1
)
self
.
assertEqual
(
memio
.
readline
(),
self
.
EOF
)
buf
=
self
.
buftype
(
"1234567890
\n
"
)
buf
=
self
.
buftype
(
"1234567890
\n
"
)
memio
=
self
.
ioclass
((
buf
*
3
)[:
-
1
])
memio
=
self
.
ioclass
((
buf
*
3
)[:
-
1
])
...
@@ -217,6 +224,9 @@ class MemoryTestMixin:
...
@@ -217,6 +224,9 @@ class MemoryTestMixin:
memio
.
seek
(
0
)
memio
.
seek
(
0
)
self
.
assertEqual
(
memio
.
readlines
(
None
),
[
buf
]
*
10
)
self
.
assertEqual
(
memio
.
readlines
(
None
),
[
buf
]
*
10
)
self
.
assertRaises
(
TypeError
,
memio
.
readlines
,
''
)
self
.
assertRaises
(
TypeError
,
memio
.
readlines
,
''
)
# Issue #24989: Buffer overread
memio
.
seek
(
len
(
buf
)
*
10
+
1
)
self
.
assertEqual
(
memio
.
readlines
(),
[])
memio
.
close
()
memio
.
close
()
self
.
assertRaises
(
ValueError
,
memio
.
readlines
)
self
.
assertRaises
(
ValueError
,
memio
.
readlines
)
...
@@ -238,6 +248,9 @@ class MemoryTestMixin:
...
@@ -238,6 +248,9 @@ class MemoryTestMixin:
self
.
assertEqual
(
line
,
buf
)
self
.
assertEqual
(
line
,
buf
)
i
+=
1
i
+=
1
self
.
assertEqual
(
i
,
10
)
self
.
assertEqual
(
i
,
10
)
# Issue #24989: Buffer overread
memio
.
seek
(
len
(
buf
)
*
10
+
1
)
self
.
assertEqual
(
list
(
memio
),
[])
memio
=
self
.
ioclass
(
buf
*
2
)
memio
=
self
.
ioclass
(
buf
*
2
)
memio
.
close
()
memio
.
close
()
self
.
assertRaises
(
ValueError
,
memio
.
__next__
)
self
.
assertRaises
(
ValueError
,
memio
.
__next__
)
...
...
Misc/NEWS
Dosyayı görüntüle @
fb397790
...
@@ -167,6 +167,9 @@ Core and Builtins
...
@@ -167,6 +167,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is
set beyond size. Based on patch by John Leitch.
- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk.
- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk.
- Issue #24839: platform._syscmd_ver raises DeprecationWarning
- Issue #24839: platform._syscmd_ver raises DeprecationWarning
...
...
Modules/_io/bytesio.c
Dosyayı görüntüle @
fb397790
...
@@ -57,14 +57,18 @@ scan_eol(bytesio *self, Py_ssize_t len)
...
@@ -57,14 +57,18 @@ scan_eol(bytesio *self, Py_ssize_t len)
Py_ssize_t
maxlen
;
Py_ssize_t
maxlen
;
assert
(
self
->
buf
!=
NULL
);
assert
(
self
->
buf
!=
NULL
);
assert
(
self
->
pos
>=
0
);
if
(
self
->
pos
>=
self
->
string_size
)
return
0
;
/* Move to the end of the line, up to the end of the string, s. */
/* Move to the end of the line, up to the end of the string, s. */
start
=
PyBytes_AS_STRING
(
self
->
buf
)
+
self
->
pos
;
maxlen
=
self
->
string_size
-
self
->
pos
;
maxlen
=
self
->
string_size
-
self
->
pos
;
if
(
len
<
0
||
len
>
maxlen
)
if
(
len
<
0
||
len
>
maxlen
)
len
=
maxlen
;
len
=
maxlen
;
if
(
len
)
{
if
(
len
)
{
start
=
PyBytes_AS_STRING
(
self
->
buf
)
+
self
->
pos
;
n
=
memchr
(
start
,
'\n'
,
len
);
n
=
memchr
(
start
,
'\n'
,
len
);
if
(
n
)
if
(
n
)
/* Get the length from the current position to the end of
/* Get the length from the current position to the end of
...
...
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