You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vyper Version (output of vyper --version): 9e3b9a2
OS: linux
Python Version (output of python --version): 3.10.4
What's your issue about?
#2418 described a bug where, during an assignment, if the right-hand side refers to the left-hand side, part of the data to be copied may get overwritten before being copied.
Although #3410 fixed the issue in most of the cases, it can still happen with function calls as shown in the examples below.
In this example, a call to foo() returns [2, 2] when it should return [2, 1].
In this example, boo() temporarily assigns values to self.a before emptying it. The values stored in self.a are however still readable from foo() as a fall to foo() here returns [11, 12, 3, 4].
a: DynArray[uint256, 10]
@external
def foo()->DynArray[uint256, 10]:
self.a = [1, 2, self.boo(), 4]
return self.a # returns [11, 12, 3, 4]
@internal
def boo() -> uint256:
self.a = [11, 12, 13, 14, 15, 16]
self.a = []
# it should now be impossible to read any of [11, 12, 13, 14, 15, 16]
return 3
Version Information
vyper --version
): 9e3b9a2python --version
): 3.10.4What's your issue about?
#2418 described a bug where, during an assignment, if the right-hand side refers to the left-hand side, part of the data to be copied may get overwritten before being copied.
Although #3410 fixed the issue in most of the cases, it can still happen with function calls as shown in the examples below.
In this example, a call to
foo()
returns[2, 2]
when it should return[2, 1]
.In this example,
boo()
temporarily assigns values toself.a
before emptying it. The values stored inself.a
are however still readable fromfoo()
as a fall tofoo()
here returns[11, 12, 3, 4]
.h/t @trocher
How can it be fixed?
Fill this in if you know how to fix it.
The text was updated successfully, but these errors were encountered: