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
25598f35
Kaydet (Commit)
25598f35
authored
May 18, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24091: Fixed various crashes in corner cases in cElementTree.
üst
14e10a19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
20 deletions
+47
-20
NEWS
Misc/NEWS
+2
-0
_elementtree.c
Modules/_elementtree.c
+45
-20
No files found.
Misc/NEWS
Dosyayı görüntüle @
25598f35
...
@@ -15,6 +15,8 @@ Core and Builtins
...
@@ -15,6 +15,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #24091: Fixed various crashes in corner cases in cElementTree.
- Issue #15267: HTTPConnection.request() now is compatibile with old-style
- Issue #15267: HTTPConnection.request() now is compatibile with old-style
classes (such as TemporaryFile). Original patch by Atsuo Ishimoto.
classes (such as TemporaryFile). Original patch by Atsuo Ishimoto.
...
...
Modules/_elementtree.c
Dosyayı görüntüle @
25598f35
...
@@ -756,7 +756,7 @@ static PyObject*
...
@@ -756,7 +756,7 @@ static PyObject*
element_extend
(
ElementObject
*
self
,
PyObject
*
args
)
element_extend
(
ElementObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
seq
;
PyObject
*
seq
;
Py_ssize_t
i
,
seqlen
=
0
;
Py_ssize_t
i
;
PyObject
*
seq_in
;
PyObject
*
seq_in
;
if
(
!
PyArg_ParseTuple
(
args
,
"O:extend"
,
&
seq_in
))
if
(
!
PyArg_ParseTuple
(
args
,
"O:extend"
,
&
seq_in
))
...
@@ -771,8 +771,7 @@ element_extend(ElementObject* self, PyObject* args)
...
@@ -771,8 +771,7 @@ element_extend(ElementObject* self, PyObject* args)
return
NULL
;
return
NULL
;
}
}
seqlen
=
PySequence_Size
(
seq
);
for
(
i
=
0
;
i
<
PySequence_Fast_GET_SIZE
(
seq
);
i
++
)
{
for
(
i
=
0
;
i
<
seqlen
;
i
++
)
{
PyObject
*
element
=
PySequence_Fast_GET_ITEM
(
seq
,
i
);
PyObject
*
element
=
PySequence_Fast_GET_ITEM
(
seq
,
i
);
if
(
element_add_subelement
(
self
,
element
)
<
0
)
{
if
(
element_add_subelement
(
self
,
element
)
<
0
)
{
Py_DECREF
(
seq
);
Py_DECREF
(
seq
);
...
@@ -805,11 +804,16 @@ element_find(ElementObject* self, PyObject* args)
...
@@ -805,11 +804,16 @@ element_find(ElementObject* self, PyObject* args)
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
PyObject
*
item
=
self
->
extra
->
children
[
i
];
PyObject
*
item
=
self
->
extra
->
children
[
i
];
if
(
Element_CheckExact
(
item
)
&&
int
rc
;
PyObject_Compare
(((
ElementObject
*
)
item
)
->
tag
,
tag
)
==
0
)
{
if
(
!
Element_CheckExact
(
item
))
Py_INCREF
(
item
);
continue
;
Py_INCREF
(
item
);
rc
=
PyObject_Compare
(((
ElementObject
*
)
item
)
->
tag
,
tag
);
if
(
rc
==
0
)
return
item
;
return
item
;
}
Py_DECREF
(
item
);
if
(
rc
<
0
&&
PyErr_Occurred
())
return
NULL
;
}
}
Py_RETURN_NONE
;
Py_RETURN_NONE
;
...
@@ -838,13 +842,24 @@ element_findtext(ElementObject* self, PyObject* args)
...
@@ -838,13 +842,24 @@ element_findtext(ElementObject* self, PyObject* args)
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
ElementObject
*
item
=
(
ElementObject
*
)
self
->
extra
->
children
[
i
];
ElementObject
*
item
=
(
ElementObject
*
)
self
->
extra
->
children
[
i
];
if
(
Element_CheckExact
(
item
)
&&
!
PyObject_Compare
(
item
->
tag
,
tag
))
{
int
rc
;
if
(
!
Element_CheckExact
(
item
))
continue
;
Py_INCREF
(
item
);
rc
=
PyObject_Compare
(
item
->
tag
,
tag
);
if
(
rc
==
0
)
{
PyObject
*
text
=
element_get_text
(
item
);
PyObject
*
text
=
element_get_text
(
item
);
if
(
text
==
Py_None
)
if
(
text
==
Py_None
)
{
Py_DECREF
(
item
);
return
PyString_FromString
(
""
);
return
PyString_FromString
(
""
);
}
Py_XINCREF
(
text
);
Py_XINCREF
(
text
);
Py_DECREF
(
item
);
return
text
;
return
text
;
}
}
Py_DECREF
(
item
);
if
(
rc
<
0
&&
PyErr_Occurred
())
return
NULL
;
}
}
Py_INCREF
(
default_value
);
Py_INCREF
(
default_value
);
...
@@ -876,12 +891,17 @@ element_findall(ElementObject* self, PyObject* args)
...
@@ -876,12 +891,17 @@ element_findall(ElementObject* self, PyObject* args)
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
PyObject
*
item
=
self
->
extra
->
children
[
i
];
PyObject
*
item
=
self
->
extra
->
children
[
i
];
if
(
Element_CheckExact
(
item
)
&&
int
rc
;
PyObject_Compare
(((
ElementObject
*
)
item
)
->
tag
,
tag
)
==
0
)
{
if
(
!
Element_CheckExact
(
item
))
if
(
PyList_Append
(
out
,
item
)
<
0
)
{
continue
;
Py_DECREF
(
out
);
Py_INCREF
(
item
);
return
NULL
;
rc
=
PyObject_Compare
(((
ElementObject
*
)
item
)
->
tag
,
tag
);
}
if
(
rc
==
0
)
rc
=
PyList_Append
(
out
,
item
);
Py_DECREF
(
item
);
if
(
rc
<
0
&&
PyErr_Occurred
())
{
Py_DECREF
(
out
);
return
NULL
;
}
}
}
}
...
@@ -1147,8 +1167,10 @@ static PyObject*
...
@@ -1147,8 +1167,10 @@ static PyObject*
element_remove
(
ElementObject
*
self
,
PyObject
*
args
)
element_remove
(
ElementObject
*
self
,
PyObject
*
args
)
{
{
int
i
;
int
i
;
int
rc
;
PyObject
*
element
;
PyObject
*
element
;
PyObject
*
found
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!:remove"
,
&
Element_Type
,
&
element
))
if
(
!
PyArg_ParseTuple
(
args
,
"O!:remove"
,
&
Element_Type
,
&
element
))
return
NULL
;
return
NULL
;
...
@@ -1164,11 +1186,14 @@ element_remove(ElementObject* self, PyObject* args)
...
@@ -1164,11 +1186,14 @@ element_remove(ElementObject* self, PyObject* args)
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
extra
->
length
;
i
++
)
{
if
(
self
->
extra
->
children
[
i
]
==
element
)
if
(
self
->
extra
->
children
[
i
]
==
element
)
break
;
break
;
if
(
PyObject_Compare
(
self
->
extra
->
children
[
i
],
element
)
==
0
)
rc
=
PyObject_Compare
(
self
->
extra
->
children
[
i
],
element
);
if
(
rc
==
0
)
break
;
break
;
if
(
rc
<
0
&&
PyErr_Occurred
())
return
NULL
;
}
}
if
(
i
=
=
self
->
extra
->
length
)
{
if
(
i
>
=
self
->
extra
->
length
)
{
/* element is not in children, so raise exception */
/* element is not in children, so raise exception */
PyErr_SetString
(
PyErr_SetString
(
PyExc_ValueError
,
PyExc_ValueError
,
...
@@ -1177,13 +1202,13 @@ element_remove(ElementObject* self, PyObject* args)
...
@@ -1177,13 +1202,13 @@ element_remove(ElementObject* self, PyObject* args)
return
NULL
;
return
NULL
;
}
}
Py_DECREF
(
self
->
extra
->
children
[
i
])
;
found
=
self
->
extra
->
children
[
i
]
;
self
->
extra
->
length
--
;
self
->
extra
->
length
--
;
for
(;
i
<
self
->
extra
->
length
;
i
++
)
for
(;
i
<
self
->
extra
->
length
;
i
++
)
self
->
extra
->
children
[
i
]
=
self
->
extra
->
children
[
i
+
1
];
self
->
extra
->
children
[
i
]
=
self
->
extra
->
children
[
i
+
1
];
Py_DECREF
(
found
);
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
...
...
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