diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 4 | ||||
-rw-r--r-- | Objects/longobject.c | 2 | ||||
-rw-r--r-- | Objects/obmalloc.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 90bbf2a5d0..dcd7b5efe5 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -49,7 +49,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize) new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6); /* check for integer overflow */ - if (new_allocated > PY_SIZE_MAX - newsize) { + if (new_allocated > SIZE_MAX - newsize) { PyErr_NoMemory(); return -1; } else { @@ -59,7 +59,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize) if (newsize == 0) new_allocated = 0; items = self->ob_item; - if (new_allocated <= (PY_SIZE_MAX / sizeof(PyObject *))) + if (new_allocated <= (SIZE_MAX / sizeof(PyObject *))) PyMem_RESIZE(items, PyObject *, new_allocated); else items = NULL; diff --git a/Objects/longobject.c b/Objects/longobject.c index 6eb40e40df..740b7f5886 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -721,7 +721,7 @@ _PyLong_NumBits(PyObject *vv) assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0); if (ndigits > 0) { digit msd = v->ob_digit[ndigits - 1]; - if ((size_t)(ndigits - 1) > PY_SIZE_MAX / (size_t)PyLong_SHIFT) + if ((size_t)(ndigits - 1) > SIZE_MAX / (size_t)PyLong_SHIFT) goto Overflow; result = (size_t)(ndigits - 1) * (size_t)PyLong_SHIFT; do { diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index c201da1a37..54d68b7549 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1057,7 +1057,7 @@ new_arena(void) if (numarenas <= maxarenas) return NULL; /* overflow */ #if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > PY_SIZE_MAX / sizeof(*arenas)) + if (numarenas > SIZE_MAX / sizeof(*arenas)) return NULL; /* overflow */ #endif nbytes = numarenas * sizeof(*arenas); |