Skip to content

Commit 0471ff4

Browse files
nuevoalexnuevoalex
authored andcommitted
delegator size padding
1 parent 88dd74a commit 0471ff4

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

source/contracts/libraries/Delegator.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ contract Delegator is DelegationTarget {
2424
//0x40 is the address where the next free memory slot is stored in Solidity
2525
let _calldataMemoryOffset := mload(0x40)
2626
// Update the pointer at 0x40 to point at new free memory location so any theoretical allocation doesn't stomp our memory in this call
27-
let _size := 0
28-
switch gt(calldatasize, 32)
29-
case 1 {
30-
_size := calldatasize
31-
} default {
32-
_size := 32
33-
}
27+
let _size := and(add(calldatasize, 0x1f), not(0x1f))
3428
mstore(0x40, add(_calldataMemoryOffset, _size))
3529
// Copy method signature and parameters of this call into memory
3630
calldatacopy(_calldataMemoryOffset, 0x0, calldatasize)

0 commit comments

Comments
 (0)