Mercurial > cpython-lru_cache-weakref
diff Modules/mmapmodule.c @ 48114:c4d24fc8ba8a legacy-trunk
Security patches from Apple: prevent int overflow when allocating memory
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Thu, 31 Jul 2008 17:17:14 +0000 |
| parents | 52294af4b663 |
| children | 7f038a4700b1 |
line wrap: on
line diff
--- a/Modules/mmapmodule.c Thu Jul 31 15:15:45 2008 +0000 +++ b/Modules/mmapmodule.c Thu Jul 31 17:17:14 2008 +0000 @@ -239,7 +239,7 @@ return(NULL); /* silently 'adjust' out-of-range requests */ - if ((self->pos + num_bytes) > self->size) { + if (num_bytes > self->size - self->pos) { num_bytes -= (self->pos+num_bytes) - self->size; } result = Py_BuildValue("s#", self->data+self->pos, num_bytes);
