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
Describe the bug {box_name}.{field_name} = {value}. replaces the field {field_name} of box {box_name} created from a struct without considering the size of {value}. This issue tracks the bug when setting the value of a field to a byte array that is larger than the size defined overflowing into the next field.
To Reproduce
#pragma version 8
struct UserInfo:
birthday: bytes[10]
favourite_colour: bytes[20]
end
if Txn.ApplicationID == 0:
exit(1)
end
box<UserInfo> info_box = CreateBox("foo")
info_box.birthday = "06/02/2023OVERFLOW"
exit(1)
Expected behavior
Field favourite_colour of box with key "foo" should have an empty value ("") but is instead "OVERFLOW". You could also argue that info_box.birthday = "06/02/2023OVERFLOW" should fail outright (assigning a value larger than the size defined in the struct).
wenkanglu
changed the title
Setting the value of a field of a structured box can overflow onto the next field [BUG]
Setting the value of a field of a structured box can overflow onto the next field
Feb 6, 2023
Describe the bug
{box_name}.{field_name} = {value}
. replaces the field{field_name}
of box{box_name}
created from a struct without considering the size of{value}
. This issue tracks the bug when setting the value of a field to a byte array that is larger than the size defined overflowing into the next field.To Reproduce
Expected behavior
Field
favourite_colour
of box with key "foo" should have an empty value ("") but is instead "OVERFLOW". You could also argue thatinfo_box.birthday = "06/02/2023OVERFLOW"
should fail outright (assigning a value larger than the size defined in the struct).Additional context
Related issue: #74
The text was updated successfully, but these errors were encountered: