fix[codegen]: disable augassign with overlap#4487
Merged
charles-cooper merged 9 commits intovyperlang:masterfrom Feb 23, 2025
Merged
fix[codegen]: disable augassign with overlap#4487charles-cooper merged 9 commits intovyperlang:masterfrom
charles-cooper merged 9 commits intovyperlang:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4487 +/- ##
=======================================
Coverage 92.06% 92.06%
=======================================
Files 120 120
Lines 17330 17335 +5
Branches 2932 2935 +3
=======================================
+ Hits 15955 15960 +5
Misses 957 957
Partials 418 418 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cyberthirst
reviewed
Feb 23, 2025
cyberthirst
reviewed
Feb 23, 2025
| if var.typ._is_prim_word: | ||
| continue | ||
| # oob - GHSA-4w26-8p97-f4jp | ||
| if var in right.variable_writes or right.contains_risky_call: |
Collaborator
There was a problem hiding this comment.
staticall probably isn't risky for this case. but i don't think it matters that much
…sign-oob add tests
cyberthirst
approved these changes
Feb 23, 2025
lemenkov
pushed a commit
to fedora-ethereum/vyper
that referenced
this pull request
Feb 27, 2025
in vyper, the behavior for AugAssign is to perform the bounds checks
only before evaluation of the rhs, rather than before-and-after. in
other words, the following code:
```vyper
def poc():
a: DynArray[uint256, 2] = [1, 2]
a[1] += a.pop()
```
is equivalent to:
```vyper
def poc():
a: DynArray[uint256, 2] = [1, 2]
a[1] += a[len(a) - 1]
a.pop()
```
rather than:
```vyper
def poc():
a: DynArray[uint256, 2] = [1, 2]
s: uint256 = a[1]
t: uint256 = a.pop()
a[1] = s + t # reverts due to oob access
```
this commit blocks the potentially missing bounds check by panicking
when there is a potential write on the rhs of an AugAssign which could
change the length on the lhs.
references:
- GHSA-4w26-8p97-f4jp
---------
Co-authored-by: cyberthirst <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
mitigating PR for GHSA-4w26-8p97-f4jp (tracking issue: #4489). block the behavior
How I did it
How to verify it
Commit message
Description for the changelog
Cute Animal Picture