diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-02-02 02:00:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-02-02 02:00:15 (GMT) |
commit | 819c4e9bc41abceca28c4f8488244d03c679b8c4 (patch) | |
tree | 1873b39582392fea4c23adf98020b241ae0059ac /Modules/itertoolsmodule.c | |
parent | d40f136d35cbe2ac4dd5b3bc8e3474343865b8dd (diff) | |
parent | 4b40eeb33901c3a520ce78ae88eb5ee06870130f (diff) | |
download | cpython-819c4e9bc41abceca28c4f8488244d03c679b8c4.zip cpython-819c4e9bc41abceca28c4f8488244d03c679b8c4.tar.gz cpython-819c4e9bc41abceca28c4f8488244d03c679b8c4.tar.bz2 |
merge 3.3 (#23366)
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 ae5b166..b631c35 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -2359,6 +2359,10 @@ combinations_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(); |