Skip to content
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

feat: remediations #6

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/SentinelList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
next = self.entries[next];
self.entries[current] = ZERO_ADDRESS;
}
self.entries[SENTINEL] = ZERO_ADDRESS;
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: fixes I7

}

function contains(SentinelList storage self, address entry) internal view returns (bool) {
Expand Down Expand Up @@ -104,7 +103,7 @@
// Set correct size of returned array
// solhint-disable-next-line no-inline-assembly
/// @solidity memory-safe-assembly
assembly {

Check warning on line 106 in src/SentinelList.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

Avoid to use inline assembly. It is acceptable only in rare cases
mstore(array, entryCount)
}
}
Expand Down
1 change: 0 additions & 1 deletion src/SentinelList4337.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
next = self.entries[next][account];
self.entries[current][account] = ZERO_ADDRESS;
}
self.entries[SENTINEL][account] = ZERO_ADDRESS;
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: fixes I7

}

function contains(
Expand Down Expand Up @@ -146,7 +145,7 @@
// Set correct size of returned array
// solhint-disable-next-line no-inline-assembly
/// @solidity memory-safe-assembly
assembly {

Check warning on line 148 in src/SentinelList4337.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

Avoid to use inline assembly. It is acceptable only in rare cases
mstore(array, entryCount)
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/SentinelListBytes32.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
next = self.entries[next];
self.entries[current] = ZERO;
}
self.entries[SENTINEL] = ZERO;
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: fixes I7

}

function contains(LinkedBytes32 storage self, bytes32 entry) internal view returns (bool) {
Expand All @@ -71,7 +70,7 @@
view
returns (bytes32[] memory array, bytes32 next)
{
if (start != SENTINEL && contains(self, start)) revert LinkedList_InvalidEntry(start);
if (start != SENTINEL && !contains(self, start)) revert LinkedList_InvalidEntry(start);
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: fixes L6

if (pageSize == 0) revert LinkedList_InvalidPage();
// Init array with max page size
array = new bytes32[](pageSize);
Expand All @@ -98,13 +97,13 @@
* incSENTINELrent page, nor will it be included in the next one if you pass it as a
* start.
*/
if (next != SENTINEL) {
if (next != SENTINEL && entryCount > 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: fixes underflow bug previously fixed in other flavours of the lib

next = array[entryCount - 1];
}
// Set correct size of returned array
// solhint-disable-next-line no-inline-assembly
/// @solidity memory-safe-assembly
assembly {

Check warning on line 106 in src/SentinelListBytes32.sol

View workflow job for this annotation

GitHub Actions / lint / forge-lint

Avoid to use inline assembly. It is acceptable only in rare cases
mstore(array, entryCount)
}
}
Expand Down