From: Trent Mick Date: Sun, 13 Aug 2000 22:47:45 +0000 (+0000) Subject: Check for overflow in list object insertion and raise OverflowError. X-Git-Tag: v2.0b1~474 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5846641342a18d31f66e6f8d9cdbf140f9940cd;p=python Check for overflow in list object insertion and raise OverflowError. see: http://www.python.org/pipermail/python-dev/2000-August/014971.html --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 42eedf2b72..2b016eda19 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -134,6 +134,11 @@ ins1(PyListObject *self, int where, PyObject *v) PyErr_BadInternalCall(); return -1; } + if (self->ob_size == INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "cannot add more objects to list"); + return -1; + } items = self->ob_item; NRESIZE(items, PyObject *, self->ob_size+1); if (items == NULL) {