diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-02-01 21:11:54 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-02-01 21:11:54 -0500 |
commit | 38d9772622fa13f7dc1033cd29bad1b15a31c8b4 (patch) | |
tree | cae2697191bffe2ea4791a98e35f4732a75bacdf /Modules/itertoolsmodule.c | |
parent | 4db56d5002e536bf37ed2a3fa32d899d873bde77 (diff) | |
parent | f635dc32b1dc3d322acd281921afdb8c13261838 (diff) | |
download | cpython-git-38d9772622fa13f7dc1033cd29bad1b15a31c8b4.tar.gz |
merge 3.4 (#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 b631c352be..610799f344 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(); |