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

fix: concat buffer bug #3738

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jan 18, 2024

What I did

fix #3737

How I did it

How to verify it

Commit message

the `concat()` builtin did not respect the `copy_bytes()` API, it
allocated a buffer in some cases which did not have enough padding.

patches GHSA-2q8v-3gqq-4f8p

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (56b0d4f) 84.78% compared to head (80f409e) 84.58%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3738      +/-   ##
==========================================
- Coverage   84.78%   84.58%   -0.20%     
==========================================
  Files          92       92              
  Lines       13137    13139       +2     
  Branches     2929     2929              
==========================================
- Hits        11138    11114      -24     
- Misses       1535     1560      +25     
- Partials      464      465       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add the other PoCs and assert c.foo() == -1? tested different paths

# GHSA-2q8v-3gqq-4f8p
code = """
s: String[1]
s2: String[33]
s3: String[34]

@external
def __init__():
    self.s = "a"
    self.s2 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # 33*'a'

@internal
def bar() -> uint256:
    self.s3 = concat(self.s, self.s2)
    return 1

@external
def foo() -> int256:
    i: int256 = -1
    b: uint256 = self.bar()
    return i
"""
# GHSA-2q8v-3gqq-4f8p
code = """
i: immutable(int256)

@external
def __init__():
    i = -1
    s: String[2] = concat("a", "b")

@external
def foo() -> int256:
    return i
"""

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 80f409e and 50b50cd

@charles-cooper charles-cooper enabled auto-merge (squash) January 18, 2024 17:51
@charles-cooper charles-cooper merged commit 55e18f6 into vyperlang:master Jan 18, 2024
84 checks passed
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 this pull request may close these issues.

concat builtin can overrun memory
3 participants