Skip to content

Commit

Permalink
Add bounds check to sha2 method (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog authored Jan 11, 2025
1 parent cc45e9c commit 977d4bd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Sha2Ext.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ library Sha2Ext {
0x6c44198c4a475817
];

require(offset + length <= message.length, "OUT_OF_BOUNDS");
bytes memory padding = padMessage(message, offset, length);
require(padding.length % 128 == 0, "PADDING_ERROR");
uint64[80] memory w;
Expand Down

0 comments on commit 977d4bd

Please sign in to comment.