WIP: fix(gnovm): validate assignment targets in range, compound assign, and inc/dec#5804
Closed
ltzmaxwell wants to merge 23 commits into
Closed
WIP: fix(gnovm): validate assignment targets in range, compound assign, and inc/dec#5804ltzmaxwell wants to merge 23 commits into
ltzmaxwell wants to merge 23 commits into
Conversation
…atten string check
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
…compound-assign and inc/dec targets)
…targets at callers
Contributor
Author
|
Folded into #5764 — the range key/value handling and target validation are one design; reviewing them together is more coherent. All commits from this branch are merged there. |
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.
Depends on #5764 (stacked on its head; review the commits above the merge boundary).
assertValidAssignLhswas only called from the plain-=branches, so unassignable targets slipped through elsewhere:for _, c = range awithconst candc++panicked at runtime,for k, nil = range mpassed preprocess (nil static type aliases blank), andc += 1/s[0] += 1ran with the write silently discarded.assertValidAssignLhson the non-blank range value operand, the compound-assign LHS, and theIncDecStmtoperand — after the operator/type checks for the latter two, matching go/types error precedence (add_assign_a0,runtime_a3,shift_d44goldens).types/assign_range_f/g/h.gno(const andnilas range value),types/assign_op_a/b.gno(const+=, string-index+=),types/incdec_a5.gno(const++).