Read about our upcoming Code of Conduct on this issue

Commit 769cfcac authored by Bernd Schoeller's avatar Bernd Schoeller
Browse files

Checking for overflow in ctypes array creation (fixing test.test_ctypes)

(grafted from 9f57693bca37)
parent 9f7ce234ad3a
......@@ -267,6 +267,8 @@ def create_array_type(base, length):
raise TypeError("Can't multiply a ctypes type by a non-integer")
if length < 0:
raise ValueError("Array length must be >= 0")
if length * base._sizeofinstances() > sys.maxsize:
raise OverflowError("array too large")
key = (base, length)
return ARRAY_CACHE[key]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment