Skip to content

Commit

Permalink
Add bounds check to keccak function (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog authored Jan 11, 2025
1 parent e6fc0d4 commit 4743795
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/LibBytes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.15;

library LibBytes {
function keccak(bytes memory data, uint256 offset, uint256 length) internal pure returns (bytes32 result) {
require(offset + length <= data.length, "index out of bounds");
assembly {
result := keccak256(add(data, add(32, offset)), length)
}
Expand Down

0 comments on commit 4743795

Please sign in to comment.