-
Notifications
You must be signed in to change notification settings - Fork 440
fix(avl): add missing checks in avl package #4908
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
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks Summary🔴 Pending initial approval by a review team member, or review from tech-staff 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
|
…orted (ref: pager/z_filetest.gno)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
||
| // fast paths. these happen only if TraverseByOffset is called directly on a leaf. | ||
| if limit <= 0 || offset >= node.size { | ||
| if limit <= 0 || node.size <= offset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I think it is better you can have this change reverted to avoid reviewing uneccessary changes
| if index != 0 { | ||
| panic("GetByIndex asked for invalid index") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
nitpick: I think it is better you can have this change reverted to avoid reviewing uneccessary changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is not return first, therefore it is hard to read and should be change (As I've done in #4889). If not done in this PR, it should be done in another.
Fix: #4440 (already closed)
This follows notJoon comment :
The three issues you pointed out can be resolved with proper bounds checking alone, without requiring separate type changes. In particular, it would be good to add guard for GetByIndex and TraverseByOffset methods.from #4440 (comment)As well I added a check on pager
GetPageWithSize, as it can trigger a division by zero / undefined behavior.I verified and there shouldn't be any other needed checks in avl packages.