Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make_setter is incorrect for complex types when RHS references LHS with .append() #4056

Closed
trocher opened this issue May 28, 2024 · 0 comments · Fixed by #4059
Closed

make_setter is incorrect for complex types when RHS references LHS with .append() #4056

trocher opened this issue May 28, 2024 · 0 comments · Fixed by #4059

Comments

@trocher
Copy link
Contributor

trocher commented May 28, 2024

Version Information

  • vyper Version (output of vyper --version): 0.4.0rc6+commit.608feda9
  • OS: osx
  • Python Version (output of python --version): 3.11.4

What's your issue about?

Yet another occurrence of #2418 and #3503

Previous fixes patch the occurrence of make_setter in Stmt.parse_Assign(), however the occurrence of make_setter in core.append_dyn_array() called by Expr.parse_Call() happens to be affected by the same issue:

make_setter(get_element_ptr(darray_node, len_, array_bounds_check=False), elem_node)

POC

a: DynArray[DynArray[uint256, 10], 10]

@external
def foo() -> DynArray[uint256, 10]:
   self.a.append([1, 2, self.boo(), 4])
   return self.a[0] # returns [11, 12, 3, 4]
@internal
def boo() -> uint256:
   self.a.append([11, 12, 13, 14, 15, 16])
   self.a.pop()
   # it should now be impossible to read any of [11, 12, 13, 14, 15, 16]
   return 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant