summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-07 01:34:14 -0700
committerStefan Krah <skrah@bytereef.org>2019-06-07 10:34:14 +0200
commit8f0bbbdcae73f275faff90cc4559f6111116f001 (patch)
tree47506daf7f147301e049066def24354b96c008c3 /Modules
parent685b806549cc956aeeb3a57fe15ee5a4d1704aed (diff)
downloadcpython-git-8f0bbbdcae73f275faff90cc4559f6111116f001.tar.gz
bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (GH-13881) (#13882)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 0692b45835..8fa6627552 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 > PY_SSIZE_T_MAX / itemsize) {
+ if (itemsize != 0 && length > PY_SSIZE_T_MAX / itemsize) {
PyErr_SetString(PyExc_OverflowError,
"array too large");
goto error;