diff options
author | Trent Mick <trentm@activestate.com> | 2000-08-13 22:47:45 (GMT) |
---|---|---|
committer | Trent Mick <trentm@activestate.com> | 2000-08-13 22:47:45 (GMT) |
commit | a5846641342a18d31f66e6f8d9cdbf140f9940cd (patch) | |
tree | 07ea9bd969433bd6ed375418ea5385f24e6bc3e7 /Objects/listobject.c | |
parent | 87df80d542b5bc0adeca2c864b6db19afe7f64aa (diff) | |
download | cpython-a5846641342a18d31f66e6f8d9cdbf140f9940cd.zip cpython-a5846641342a18d31f66e6f8d9cdbf140f9940cd.tar.gz cpython-a5846641342a18d31f66e6f8d9cdbf140f9940cd.tar.bz2 |
Check for overflow in list object insertion and raise OverflowError.
see: http://www.python.org/pipermail/python-dev/2000-August/014971.html
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 42eedf2..2b016ed 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) { |