diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-04-03 18:59:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-04-03 18:59:51 (GMT) |
commit | fd83a823a6f268dc97ee2bf7d8a1a88d948446e5 (patch) | |
tree | be7275338e9e9a721882eafca2c1f48ae6b88693 /Modules | |
parent | a110817c080ca3c2f3262350b5d7e0c0582527e6 (diff) | |
download | cpython-fd83a823a6f268dc97ee2bf7d8a1a88d948446e5.zip cpython-fd83a823a6f268dc97ee2bf7d8a1a88d948446e5.tar.gz cpython-fd83a823a6f268dc97ee2bf7d8a1a88d948446e5.tar.bz2 |
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660) (GH-12678)
(cherry picked from commit 487b73ab39c80157474821ef9083f51e0846bd62)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 33e2243..d608100 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1534,7 +1534,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } itemsize = itemdict->size; - if (length * itemsize < 0) { + if (length > PY_SSIZE_T_MAX / itemsize) { PyErr_SetString(PyExc_OverflowError, "array too large"); Py_DECREF(stgdict); |