diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-04-03 10:55:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-03 10:55:26 -0700 |
commit | 9c08eeb30ca0e551323467b62ae40e08e30839b3 (patch) | |
tree | a38beb6730b74f4a892b28a716d248c18f75641a /Modules | |
parent | ef516d11c1a0f885dba0aba8cf5366502077cdd4 (diff) | |
download | cpython-git-9c08eeb30ca0e551323467b62ae40e08e30839b3.tar.gz |
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660)
(cherry picked from commit 487b73ab39c80157474821ef9083f51e0846bd62)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
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 be0b321bad..153990309b 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1466,7 +1466,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; |