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
c9926088
Kaydet (Commit)
c9926088
authored
May 03, 2014
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 21375: Fix possible Py_ssizet overflow in heapq.
üst
ceced6bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
_heapqmodule.c
Modules/_heapqmodule.c
+8
-8
No files found.
Modules/_heapqmodule.c
Dosyayı görüntüle @
c9926088
...
...
@@ -62,7 +62,7 @@ _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos)
static
int
_siftup
(
PyListObject
*
heap
,
Py_ssize_t
pos
)
{
Py_ssize_t
startpos
,
endpos
,
childpos
,
rightpos
;
Py_ssize_t
startpos
,
endpos
,
childpos
,
rightpos
,
limit
;
int
cmp
;
PyObject
*
newitem
,
*
tmp
,
*
olditem
;
Py_ssize_t
size
;
...
...
@@ -79,9 +79,10 @@ _siftup(PyListObject *heap, Py_ssize_t pos)
Py_INCREF
(
newitem
);
/* Bubble up the smaller child until hitting a leaf. */
childpos
=
2
*
pos
+
1
;
/* leftmost child position
*/
while
(
childpos
<
endpos
)
{
limit
=
endpos
/
2
;
/* smallest pos that has no child
*/
while
(
pos
<
limit
)
{
/* Set childpos to index of smaller child. */
childpos
=
2
*
pos
+
1
;
/* leftmost child position */
rightpos
=
childpos
+
1
;
if
(
rightpos
<
endpos
)
{
cmp
=
PyObject_RichCompareBool
(
...
...
@@ -108,7 +109,6 @@ _siftup(PyListObject *heap, Py_ssize_t pos)
PyList_SET_ITEM
(
heap
,
pos
,
tmp
);
Py_DECREF
(
olditem
);
pos
=
childpos
;
childpos
=
2
*
pos
+
1
;
if
(
size
!=
PyList_GET_SIZE
(
heap
))
{
PyErr_SetString
(
PyExc_RuntimeError
,
"list changed size during iteration"
);
...
...
@@ -419,7 +419,7 @@ _siftdownmax(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos)
static
int
_siftupmax
(
PyListObject
*
heap
,
Py_ssize_t
pos
)
{
Py_ssize_t
startpos
,
endpos
,
childpos
,
rightpos
;
Py_ssize_t
startpos
,
endpos
,
childpos
,
rightpos
,
limit
;
int
cmp
;
PyObject
*
newitem
,
*
tmp
;
...
...
@@ -434,9 +434,10 @@ _siftupmax(PyListObject *heap, Py_ssize_t pos)
Py_INCREF
(
newitem
);
/* Bubble up the smaller child until hitting a leaf. */
childpos
=
2
*
pos
+
1
;
/* leftmost child position
*/
while
(
childpos
<
endpos
)
{
limit
=
endpos
/
2
;
/* smallest pos that has no child
*/
while
(
pos
<
limit
)
{
/* Set childpos to index of smaller child. */
childpos
=
2
*
pos
+
1
;
/* leftmost child position */
rightpos
=
childpos
+
1
;
if
(
rightpos
<
endpos
)
{
cmp
=
PyObject_RichCompareBool
(
...
...
@@ -456,7 +457,6 @@ _siftupmax(PyListObject *heap, Py_ssize_t pos)
Py_DECREF
(
PyList_GET_ITEM
(
heap
,
pos
));
PyList_SET_ITEM
(
heap
,
pos
,
tmp
);
pos
=
childpos
;
childpos
=
2
*
pos
+
1
;
}
/* The leaf at pos is empty now. Put newitem there, and bubble
...
...
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