diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-06-08 09:19:24 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2019-06-08 09:19:24 (GMT) |
commit | 48f190f79cd89f7ad4409b3c782e462368583309 (patch) | |
tree | 2a711419e572d67b4eddad1edf801878830aa3c6 /Modules | |
parent | 2bfc2dc214445550521074f428245b502d215eac (diff) | |
download | cpython-48f190f79cd89f7ad4409b3c782e462368583309.zip cpython-48f190f79cd89f7ad4409b3c782e462368583309.tar.gz cpython-48f190f79cd89f7ad4409b3c782e462368583309.tar.bz2 |
[2.7] bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13906)
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 d608100..bef251e 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 > PY_SSIZE_T_MAX / itemsize) { + if (itemsize != 0 && length > PY_SSIZE_T_MAX / itemsize) { PyErr_SetString(PyExc_OverflowError, "array too large"); Py_DECREF(stgdict); |