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
2ecd3c36
Kaydet (Commit)
2ecd3c36
authored
Nis 01, 2009
tarafından
Jack Diederich
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bounds check arguments to mmap.move(). All of them. Really.
fixes crasher on OS X 10.5
üst
ce3d2214
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
test_mmap.py
Lib/test/test_mmap.py
+14
-7
mmapmodule.c
Modules/mmapmodule.c
+9
-9
No files found.
Lib/test/test_mmap.py
Dosyayı görüntüle @
2ecd3c36
...
@@ -359,15 +359,22 @@ class MmapTests(unittest.TestCase):
...
@@ -359,15 +359,22 @@ class MmapTests(unittest.TestCase):
m
.
move
(
source
,
dest
,
size
)
m
.
move
(
source
,
dest
,
size
)
except
ValueError
:
except
ValueError
:
pass
pass
self
.
assertRaises
(
ValueError
,
m
.
move
,
-
1
,
-
1
,
-
1
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
-
1
,
-
1
,
0
)
offsets
=
[(
-
1
,
-
1
,
-
1
),
(
-
1
,
-
1
,
0
),
(
-
1
,
0
,
-
1
),
(
0
,
-
1
,
-
1
),
self
.
assertRaises
(
ValueError
,
m
.
move
,
-
1
,
0
,
-
1
)
(
-
1
,
0
,
0
),
(
0
,
-
1
,
0
),
(
0
,
0
,
-
1
)]
self
.
assertRaises
(
ValueError
,
m
.
move
,
0
,
-
1
,
-
1
)
for
source
,
dest
,
size
in
offsets
:
self
.
assertRaises
(
ValueError
,
m
.
move
,
-
1
,
0
,
0
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
source
,
dest
,
size
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
0
,
-
1
,
0
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
0
,
0
,
-
1
)
m
.
close
()
m
.
close
()
m
=
mmap
.
mmap
(
-
1
,
1
)
# single byte
self
.
assertRaises
(
ValueError
,
m
.
move
,
0
,
0
,
2
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
1
,
0
,
1
)
self
.
assertRaises
(
ValueError
,
m
.
move
,
0
,
1
,
1
)
m
.
move
(
0
,
0
,
1
)
m
.
move
(
0
,
0
,
0
)
def
test_anonymous
(
self
):
def
test_anonymous
(
self
):
# anonymous mmap.mmap(-1, PAGE)
# anonymous mmap.mmap(-1, PAGE)
m
=
mmap
.
mmap
(
-
1
,
PAGESIZE
)
m
=
mmap
.
mmap
(
-
1
,
PAGESIZE
)
...
...
Modules/mmapmodule.c
Dosyayı görüntüle @
2ecd3c36
...
@@ -609,23 +609,23 @@ mmap_seek_method(mmap_object *self, PyObject *args)
...
@@ -609,23 +609,23 @@ mmap_seek_method(mmap_object *self, PyObject *args)
static
PyObject
*
static
PyObject
*
mmap_move_method
(
mmap_object
*
self
,
PyObject
*
args
)
mmap_move_method
(
mmap_object
*
self
,
PyObject
*
args
)
{
{
unsigned
long
dest
,
src
,
c
ou
nt
;
unsigned
long
dest
,
src
,
cnt
;
CHECK_VALID
(
NULL
);
CHECK_VALID
(
NULL
);
if
(
!
PyArg_ParseTuple
(
args
,
"kkk:move"
,
&
dest
,
&
src
,
&
c
ou
nt
)
||
if
(
!
PyArg_ParseTuple
(
args
,
"kkk:move"
,
&
dest
,
&
src
,
&
cnt
)
||
!
is_writeable
(
self
))
{
!
is_writeable
(
self
))
{
return
NULL
;
return
NULL
;
}
else
{
}
else
{
/* bounds check the values */
/* bounds check the values */
unsigned
long
pos
=
src
>
dest
?
src
:
dest
;
if
(
cnt
<
0
||
(
cnt
+
dest
)
<
cnt
||
(
cnt
+
src
)
<
cnt
||
if
(
self
->
size
<
pos
||
count
>
self
->
size
-
pos
)
{
src
<
0
||
src
>
self
->
size
||
(
src
+
cnt
)
>
self
->
size
||
dest
<
0
||
dest
>
self
->
size
||
(
dest
+
cnt
)
>
self
->
size
)
{
PyErr_SetString
(
PyExc_ValueError
,
PyErr_SetString
(
PyExc_ValueError
,
"source or destination
out of range"
);
"source, destination, or count
out of range"
);
return
NULL
;
return
NULL
;
}
else
{
memmove
(
self
->
data
+
dest
,
self
->
data
+
src
,
count
);
Py_INCREF
(
Py_None
);
return
Py_None
;
}
}
memmove
(
self
->
data
+
dest
,
self
->
data
+
src
,
cnt
);
Py_INCREF
(
Py_None
);
return
Py_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