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
c839c2f2
Kaydet (Commit)
c839c2f2
authored
Eyl 25, 2006
tarafından
Armin Rigo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Another crasher.
üst
c7986cee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
loosing_mro_ref.py
Lib/test/crashers/loosing_mro_ref.py
+36
-0
No files found.
Lib/test/crashers/loosing_mro_ref.py
0 → 100644
Dosyayı görüntüle @
c839c2f2
"""
There is a way to put keys of any type in a type's dictionary.
I think this allows various kinds of crashes, but so far I have only
found a convoluted attack of _PyType_Lookup(), which uses the mro of the
type without holding a strong reference to it. Probably works with
super.__getattribute__() too, which uses the same kind of code.
"""
class
MyKey
(
object
):
def
__hash__
(
self
):
return
hash
(
'mykey'
)
def
__cmp__
(
self
,
other
):
# the following line decrefs the previous X.__mro__
X
.
__bases__
=
(
Base2
,)
# trash all tuples of length 3, to make sure that the items of
# the previous X.__mro__ are really garbage
z
=
[]
for
i
in
range
(
1000
):
z
.
append
((
i
,
None
,
None
))
return
-
1
class
Base
(
object
):
mykey
=
'from Base'
class
Base2
(
object
):
mykey
=
'from Base2'
class
X
(
Base
):
# you can't add a non-string key to X.__dict__, but it can be
# there from the beginning :-)
locals
()[
MyKey
()]
=
5
print
X
.
mykey
# I get a segfault, or a slightly wrong assertion error in a debug build.
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