Skip to content

Use zero values for calldata (CalldataCopy) and returndata (ReturndataCopy) out-of-range slice portions #10933

Description

@jeanmon

Follow up of #7385 where errors for the out-of-range memory target were introduced. In this case, we do not throw an error but return zero values, e.g.,
calldata = [0,1,2,3,4,5,6,7]
slice of calldata with startPos = 4 and size = 8 will return [4,5,6,7,0,0,0,0].

Activity

  1. added
    C-avmComponent: AVM related tickets (aka public VM)
    on Dec 23, 2024
  2. jeanmon commented on Jan 15, 2025

    @jeanmon
    ContributorAuthor

    According to the current code, a TS slice is applied on the array (calldata resp. returndata) which does not throw an error but will "slice" the valid truncated portion of the array or return an empty array.
    This will lead to an assertion being hit ( memory.assert({ reads: 2, writes: copySize, addressing });)

  3. self-assigned this
    on Jan 15, 2025
  4. moved this from Todo to In Progress in A3on Jan 15, 2025
  5. changed the title [-]Handle out-of-range errors for calldata (CalldataCopy) and returndata (ReturndataCopy)[/-] [+]Use zero values for calldata (CalldataCopy) and returndata (ReturndataCopy) out-of-range slice portions[/+] on Jan 16, 2025
  6. added a commit that references this issue on Jan 16, 2025
    a469c94
  7. moved this from In Progress to Done in A3on Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-avmComponent: AVM related tickets (aka public VM)

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions