changeset: 106145:eb6eafafdb44 user: Martin Panter date: Sat Jan 14 06:30:37 2017 +0000 files: Objects/listobject.c description: Issue #1621: Overflow should not be possible in listextend() diff -r 0c6ea411af17 -r eb6eafafdb44 Objects/listobject.c --- a/Objects/listobject.c Sat Jan 14 06:29:32 2017 +0000 +++ b/Objects/listobject.c Sat Jan 14 06:30:37 2017 +0000 @@ -804,6 +804,9 @@ Py_RETURN_NONE; } m = Py_SIZE(self); + /* It should not be possible to allocate a list large enough to cause + an overflow on any relevant platform */ + assert(m < PY_SSIZE_T_MAX - n); if (list_resize(self, m + n) < 0) { Py_DECREF(b); return NULL;