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
9062c261
Kaydet (Commit)
9062c261
authored
Haz 12, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag.
üst
3c317e76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
test_xml_etree.py
Lib/test/test_xml_etree.py
+7
-1
NEWS
Misc/NEWS
+2
-0
_elementtree.c
Modules/_elementtree.c
+16
-3
No files found.
Lib/test/test_xml_etree.py
Dosyayı görüntüle @
9062c261
...
@@ -18,7 +18,7 @@ import weakref
...
@@ -18,7 +18,7 @@ import weakref
from
itertools
import
product
from
itertools
import
product
from
test
import
support
from
test
import
support
from
test.support
import
TESTFN
,
findfile
,
import_fresh_module
,
gc_collect
from
test.support
import
TESTFN
,
findfile
,
import_fresh_module
,
gc_collect
,
swap_attr
# pyET is the pure-Python implementation.
# pyET is the pure-Python implementation.
#
#
...
@@ -1860,6 +1860,12 @@ class BadElementTest(ElementTestCase, unittest.TestCase):
...
@@ -1860,6 +1860,12 @@ class BadElementTest(ElementTestCase, unittest.TestCase):
e
.
extend
([
ET
.
Element
(
'bar'
)])
e
.
extend
([
ET
.
Element
(
'bar'
)])
self
.
assertRaises
(
ValueError
,
e
.
remove
,
X
(
'baz'
))
self
.
assertRaises
(
ValueError
,
e
.
remove
,
X
(
'baz'
))
def
test_recursive_repr
(
self
):
# Issue #25455
e
=
ET
.
Element
(
'foo'
)
with
swap_attr
(
e
,
'tag'
,
e
):
with
self
.
assertRaises
(
RuntimeError
):
repr
(
e
)
# Should not crash
class
MutatingElementPath
(
str
):
class
MutatingElementPath
(
str
):
def
__new__
(
cls
,
elem
,
*
args
):
def
__new__
(
cls
,
elem
,
*
args
):
...
...
Misc/NEWS
Dosyayı görüntüle @
9062c261
...
@@ -143,6 +143,8 @@ Core and Builtins
...
@@ -143,6 +143,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag.
- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283.
- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283.
- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team
- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team
...
...
Modules/_elementtree.c
Dosyayı görüntüle @
9062c261
...
@@ -1582,10 +1582,23 @@ _elementtree_Element_remove_impl(ElementObject *self, PyObject *subelement)
...
@@ -1582,10 +1582,23 @@ _elementtree_Element_remove_impl(ElementObject *self, PyObject *subelement)
static
PyObject
*
static
PyObject
*
element_repr
(
ElementObject
*
self
)
element_repr
(
ElementObject
*
self
)
{
{
i
f
(
self
->
tag
)
i
nt
status
;
return
PyUnicode_FromFormat
(
"<Element %R at %p>"
,
self
->
tag
,
self
);
else
if
(
self
->
tag
==
NULL
)
return
PyUnicode_FromFormat
(
"<Element at %p>"
,
self
);
return
PyUnicode_FromFormat
(
"<Element at %p>"
,
self
);
status
=
Py_ReprEnter
((
PyObject
*
)
self
);
if
(
status
==
0
)
{
PyObject
*
res
;
res
=
PyUnicode_FromFormat
(
"<Element %R at %p>"
,
self
->
tag
,
self
);
Py_ReprLeave
((
PyObject
*
)
self
);
return
res
;
}
if
(
status
>
0
)
PyErr_Format
(
PyExc_RuntimeError
,
"reentrant call inside %s.__repr__"
,
Py_TYPE
(
self
)
->
tp_name
);
return
NULL
;
}
}
/*[clinic input]
/*[clinic input]
...
...
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