diff options
author | Martin Panter <vadmium+py@gmail.com> | 2017-01-14 06:30:37 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2017-01-14 06:30:37 (GMT) |
commit | 94b39ceb736997eb924dc509ea0ef55f4a19c706 (patch) | |
tree | 3008a888a327b66fdff25ea8939993acbe2d85a2 /Objects/listobject.c | |
parent | 5644729aa6ead0408113f49150c543f4cef32143 (diff) | |
download | cpython-94b39ceb736997eb924dc509ea0ef55f4a19c706.zip cpython-94b39ceb736997eb924dc509ea0ef55f4a19c706.tar.gz cpython-94b39ceb736997eb924dc509ea0ef55f4a19c706.tar.bz2 |
Issue #1621: Overflow should not be possible in listextend()
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index dcd7b5e..05dddfc 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -804,6 +804,9 @@ listextend(PyListObject *self, PyObject *b) 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; |