summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 45da96f..d903eca 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -623,10 +623,8 @@ mmap_move_method(mmap_object *self, PyObject *args)
return NULL;
} else {
/* bounds check the values */
- if (/* end of source after end of data?? */
- ((src+count) > self->size)
- /* dest will fit? */
- || (dest+count > self->size)) {
+ unsigned long pos = src > dest ? src : dest;
+ if (self->size >= pos && count > self->size - pos) {
PyErr_SetString(PyExc_ValueError,
"source or destination out of range");
return NULL;