From: Benjamin Peterson Date: Thu, 6 Oct 2016 06:26:24 +0000 (-0700) Subject: make 'where' Py_ssize_t X-Git-Tag: v2.7.13rc1~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc4bdbd6a8a103afbf6525f7ee13802147001894;p=python make 'where' Py_ssize_t --- diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 297bb074ce..0dc480599f 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -585,11 +585,9 @@ mmap_seek_method(mmap_object *self, PyObject *args) if (!PyArg_ParseTuple(args, "n|i:seek", &dist, &how)) return NULL; else { - size_t where; + Py_ssize_t where; switch (how) { case 0: /* relative to start */ - if (dist < 0) - goto onoutofrange; where = dist; break; case 1: /* relative to current position */ @@ -606,7 +604,7 @@ mmap_seek_method(mmap_object *self, PyObject *args) PyErr_SetString(PyExc_ValueError, "unknown seek type"); return NULL; } - if (where > self->size) + if (where > self->size || where < 0) goto onoutofrange; self->pos = where; Py_INCREF(Py_None);