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
fc05e68d
Unverified
Kaydet (Commit)
fc05e68d
authored
Tem 05, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Tem 05, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33720: Improve tests for the stack overflow in marshal.loads(). (GH-7336)
üst
3a9bb5f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
test_marshal.py
Lib/test/test_marshal.py
+17
-6
No files found.
Lib/test/test_marshal.py
Dosyayı görüntüle @
fc05e68d
...
...
@@ -210,13 +210,24 @@ class BugsTestCase(unittest.TestCase):
except
Exception
:
pass
def
test_loads_2x_code
(
self
):
s
=
b
'c'
+
(
b
'X'
*
4
*
4
)
+
b
'{'
*
2
**
20
self
.
assertRaises
(
ValueError
,
marshal
.
loads
,
s
)
def
test_loads_recursion
(
self
):
s
=
b
'c'
+
(
b
'X'
*
4
*
5
)
+
b
'{'
*
2
**
20
self
.
assertRaises
(
ValueError
,
marshal
.
loads
,
s
)
def
run_tests
(
N
,
check
):
# (((...None...),),)
check
(
b
')
\x01
'
*
N
+
b
'N'
)
check
(
b
'(
\x01\x00\x00\x00
'
*
N
+
b
'N'
)
# [[[...None...]]]
check
(
b
'[
\x01\x00\x00\x00
'
*
N
+
b
'N'
)
# {None: {None: {None: ...None...}}}
check
(
b
'{N'
*
N
+
b
'N'
+
b
'0'
*
N
)
# frozenset([frozenset([frozenset([...None...])])])
check
(
b
'>
\x01\x00\x00\x00
'
*
N
+
b
'N'
)
# Check that the generated marshal data is valid and marshal.loads()
# works for moderately deep nesting
run_tests
(
100
,
marshal
.
loads
)
# Very deeply nested structure shouldn't blow the stack
def
check
(
s
):
self
.
assertRaises
(
ValueError
,
marshal
.
loads
,
s
)
run_tests
(
2
**
20
,
check
)
def
test_recursion_limit
(
self
):
# Create a deeply nested structure.
...
...
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