diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-06-07 08:13:26 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2019-06-07 08:13:26 (GMT) |
commit | 0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54 (patch) | |
tree | c97f618f70df6cf7d9bba176f732995441858dd2 /Modules | |
parent | 554450fb4e95066e825bdb4a2d544a490daeebdc (diff) | |
download | cpython-0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54.zip cpython-0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54.tar.gz cpython-0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54.tar.bz2 |
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13881)
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 f7513a3..2201c45 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 > PY_SSIZE_T_MAX / itemsize) { + if (itemsize != 0 && length > PY_SSIZE_T_MAX / itemsize) { PyErr_SetString(PyExc_OverflowError, "array too large"); goto error; |