diff options
author | Armin Rigo <arigo@tunes.org> | 2019-09-29 08:48:52 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2019-09-29 08:48:52 +0200 |
commit | a8195a44e156b68c432935650441296f00a014d3 (patch) | |
tree | 0ce48fc53e537dd4c4b2de5098ca4df1d7f6352a /c/test_c.py | |
parent | 6ab4b9f56ddd82ae7214bea3ab344640b61c6cca (diff) | |
download | cffi-a8195a44e156b68c432935650441296f00a014d3.tar.gz |
Issue 421: integer overflow when computing structure sizes in bits and there are more than sys.maxint bits
Diffstat (limited to 'c/test_c.py')
-rw-r--r-- | c/test_c.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/c/test_c.py b/c/test_c.py index 8aa88ef..2bb5372 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -4445,3 +4445,11 @@ def test_cannot_call_null_function_pointer(): f = cast(BFunc, 0) with pytest.raises(RuntimeError): f(40, 2) + +def test_huge_structure(): + BChar = new_primitive_type("char") + BArray = new_array_type(new_pointer_type(BChar), sys.maxsize) + assert sizeof(BArray) == sys.maxsize + BStruct = new_struct_type("struct foo") + complete_struct_or_union(BStruct, [('a1', BArray, -1)]) + assert sizeof(BStruct) == sys.maxsize |