-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Check that slice are in the reserved space in Accumulator push and shift #6302
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?
Check that slice are in the reserved space in Accumulator push and shift #6302
Conversation
🦋 Changeset detectedLatest commit: 1293a76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe pull request introduces memory reservation validation to the OpenZeppelin Solidity library. Two changeset entries document a minor version bump. A new internal function 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
ernestognw
left a comment
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.
Looks good
| function testInvalidSlice1() public pure { | ||
| bytes memory input = new bytes(256); |
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.
Maybe?
| function testInvalidSlice1() public pure { | |
| bytes memory input = new bytes(256); | |
| function testInvalidSliceOutOfBoundEnd(bytes memory input) public pure { |
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.
It will not work. For input objects that have a length that are not a multiple of 32, solidity will set the FMP to a multiple of 32. This means adding 1 is not enough to guarantee the error (because there is more reserved memory than strictly needed)
| function testInvalidSlice2() public pure { | ||
| bytes memory input = new bytes(256); |
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.
| function testInvalidSlice2() public pure { | |
| bytes memory input = new bytes(256); | |
| function testInvalidSlice2(bytes memory input) public pure { |
| assertFalse(slice.isReserved()); | ||
| } | ||
|
|
||
| function testInvalidSlice2() public pure { |
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.
| function testInvalidSlice2() public pure { | |
| function testInvalidSliceOutOfBoundLength() public pure { |
No description provided.