From bc4bdbd6a8a103afbf6525f7ee13802147001894 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 5 Oct 2016 23:26:24 -0700 Subject: make 'where' Py_ssize_t --- Modules/mmapmodule.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 297bb07..0dc4805 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); -- cgit v0.12