From 52d473ce5b4918285dfb3692ffd3cf5480583cae Mon Sep 17 00:00:00 2001 From: Vectorized Date: Fri, 11 Jul 2025 16:28:57 +0000 Subject: [PATCH] Swiss cheese dirty upper bits cleaning --- src/accounts/ERC7821.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accounts/ERC7821.sol b/src/accounts/ERC7821.sol index f6dc8d1242..2f0a22b040 100644 --- a/src/accounts/ERC7821.sol +++ b/src/accounts/ERC7821.sol @@ -235,8 +235,8 @@ contract ERC7821 is Receiver { assembly { let c := add(calls.offset, calldataload(add(calls.offset, shl(5, i)))) // Replaces `to` with `address(this)` if `address(0)` is provided. - // We'll skip cleaning the upper 96 bits of `to` as it is ignored in `call`. - to := or(mul(address(), iszero(calldataload(c))), calldataload(c)) + let t := shr(96, shl(96, calldataload(c))) + to := or(mul(address(), iszero(t)), t) value := calldataload(add(c, 0x20)) let o := add(c, calldataload(add(c, 0x40))) data.offset := add(o, 0x20)