diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-02-02 02:11:39 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-02-02 02:11:39 (GMT) |
commit | f635dc32b1dc3d322acd281921afdb8c13261838 (patch) | |
tree | 60356caab13853d253743dd8a705504fe0d21e49 /Modules/itertoolsmodule.c | |
parent | 819c4e9bc41abceca28c4f8488244d03c679b8c4 (diff) | |
parent | 6f082297b260d3eb4975d6d4305eba6fd26f9ae9 (diff) | |
download | cpython-f635dc32b1dc3d322acd281921afdb8c13261838.zip cpython-f635dc32b1dc3d322acd281921afdb8c13261838.tar.gz cpython-f635dc32b1dc3d322acd281921afdb8c13261838.tar.bz2 |
merge 3.3 (#23365)
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index b631c35..610799f 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -2704,6 +2704,10 @@ cwr_new(PyTypeObject *type, PyObject *args, PyObject *kwds) goto error; } + if (r > PY_SSIZE_T_MAX/sizeof(Py_ssize_t)) { + PyErr_SetString(PyExc_OverflowError, "r is too big"); + goto error; + } indices = PyMem_Malloc(r * sizeof(Py_ssize_t)); if (indices == NULL) { PyErr_NoMemory(); |