From 0690c79c419b8d2bdfe7c5b6dca57b018f5a5a54 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 7 Jun 2019 01:13:26 -0700 Subject: bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13881) --- Modules/_ctypes/_ctypes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules') diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index f7513a3d74..2201c4520a 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; -- cgit v1.2.1