Skip to content

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Jan 19, 2026

No description provided.

@Amxx Amxx added this to the 5.6 milestone Jan 19, 2026
@Amxx Amxx requested a review from a team as a code owner January 19, 2026 16:44
@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: 1293a76

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Walkthrough

The pull request introduces memory reservation validation to the OpenZeppelin Solidity library. Two changeset entries document a minor version bump. A new internal function isReserved(Slice) is added to the Memory utility module to check whether a memory slice is within reserved space. The Accumulators struct operations (push and shift) are updated with runtime guards that validate memory slice reservation, triggering a resource error panic if validation fails. Panic.sol is imported to support error handling. No changes to public function signatures or data structures are made.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether the description relates to the changeset. Add a description explaining the purpose of the changes, such as why slice validation is necessary and what problems it prevents.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding validation to check that slices are in reserved space during Accumulator push and shift operations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@Amxx Amxx requested a review from ernestognw January 19, 2026 17:04
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

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

Looks good

Comment on lines +47 to +48
function testInvalidSlice1() public pure {
bytes memory input = new bytes(256);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe?

Suggested change
function testInvalidSlice1() public pure {
bytes memory input = new bytes(256);
function testInvalidSliceOutOfBoundEnd(bytes memory input) public pure {

Copy link
Collaborator Author

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)

Comment on lines +60 to +61
function testInvalidSlice2() public pure {
bytes memory input = new bytes(256);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function testInvalidSlice2() public pure {
bytes memory input = new bytes(256);
function testInvalidSlice2(bytes memory input) public pure {

assertFalse(slice.isReserved());
}

function testInvalidSlice2() public pure {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function testInvalidSlice2() public pure {
function testInvalidSliceOutOfBoundLength() public pure {

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.

2 participants