Issue #5387: Fixed mmap.move crash by integer overflow.
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 95dcfbe..d191c1e 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -612,10 +612,8 @@
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;