From ed0b1e0ac8ddb47019efcff4b692ff6470fc6a04 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Fri, 20 Oct 2023 07:52:04 -0700 Subject: [PATCH] fix: add missing test for memory allocation overflow (#3650) should have been added in 68da04b2e9e0 but the file was not committed --- tests/parser/features/test_memory_alloc.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/parser/features/test_memory_alloc.py diff --git a/tests/parser/features/test_memory_alloc.py b/tests/parser/features/test_memory_alloc.py new file mode 100644 index 0000000000..ee6d15c67c --- /dev/null +++ b/tests/parser/features/test_memory_alloc.py @@ -0,0 +1,16 @@ +import pytest + +from vyper.compiler import compile_code +from vyper.exceptions import MemoryAllocationException + + +def test_memory_overflow(): + code = """ +@external +def zzz(x: DynArray[uint256, 2**59]): # 2**64 / 32 bytes per word == 2**59 + y: uint256[7] = [0,0,0,0,0,0,0] + + y[6] = y[5] + """ + with pytest.raises(MemoryAllocationException): + compile_code(code)