diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-04-02 10:47:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-04-02 10:47:51 (GMT) |
commit | 487b73ab39c80157474821ef9083f51e0846bd62 (patch) | |
tree | 48d07ecac9d6821a21a0546dab8ba1cad3997dda /Modules/_ctypes | |
parent | b8311cf5e5d72f8a8aa688b7da1760d6a74a4d72 (diff) | |
download | cpython-487b73ab39c80157474821ef9083f51e0846bd62.zip cpython-487b73ab39c80157474821ef9083f51e0846bd62.tar.gz cpython-487b73ab39c80157474821ef9083f51e0846bd62.tar.bz2 |
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660)
Diffstat (limited to 'Modules/_ctypes')
-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 b3a2030..ac071bb 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1518,7 +1518,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"); goto error; |