Release v5.2 audit fixes (#5330)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Sam Bugs <101145325+0xsambugs@users.noreply.github.com> Co-authored-by: Ernesto García <ernestognw@gmail.com> Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com> Co-authored-by: wizard <112275929+famouswizard@users.noreply.github.com> Co-authored-by: leopardracer <136604165+leopardracer@users.noreply.github.com> Co-authored-by: cairo <cairoeth@protonmail.com>
This commit is contained in:
@ -27,15 +27,13 @@ library Bytes {
|
||||
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
|
||||
*/
|
||||
function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
|
||||
unchecked {
|
||||
uint256 length = buffer.length;
|
||||
for (uint256 i = pos; i < length; ++i) {
|
||||
if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {
|
||||
return i;
|
||||
}
|
||||
uint256 length = buffer.length;
|
||||
for (uint256 i = pos; i < length; ++i) {
|
||||
if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {
|
||||
return i;
|
||||
}
|
||||
return type(uint256).max;
|
||||
}
|
||||
return type(uint256).max;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user