[Python-checkins] cpython: Issue #1621: Overflow should not be possible in listextend()
martin.panter
python-checkins at python.org
Sat Jan 14 02:25:13 EST 2017
https://hg.python.org/cpython/rev/eb6eafafdb44
changeset: 106145:eb6eafafdb44
user: Martin Panter <vadmium+py at gmail.com>
date: Sat Jan 14 06:30:37 2017 +0000
summary:
Issue #1621: Overflow should not be possible in listextend()
files:
Objects/listobject.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Objects/listobject.c b/Objects/listobject.c
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -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;
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list