]> granicus.if.org Git - python/commitdiff
Check for overflow in list object insertion and raise OverflowError.
authorTrent Mick <trentm@activestate.com>
Sun, 13 Aug 2000 22:47:45 +0000 (22:47 +0000)
committerTrent Mick <trentm@activestate.com>
Sun, 13 Aug 2000 22:47:45 +0000 (22:47 +0000)
see: http://www.python.org/pipermail/python-dev/2000-August/014971.html

Objects/listobject.c

index 42eedf2b72827eb99ba5600ff429d55c8531ff54..2b016eda199fc2629eb8afc30cabb097f7884298 100644 (file)
@@ -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) {