From 300d66d6e74172bc8b4b2c6a1f80984459def73b Mon Sep 17 00:00:00 2001 From: cairo Date: Mon, 9 Sep 2024 21:49:34 +0200 Subject: [PATCH] Tag memory safe assembly blocks (#5193) Signed-off-by: Hadrien Croubois --- contracts/governance/Governor.sol | 2 +- contracts/metatx/ERC2771Forwarder.sol | 2 +- contracts/utils/introspection/ERC165Checker.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/governance/Governor.sol b/contracts/governance/Governor.sol index be2cf79d2..453f20290 100644 --- a/contracts/governance/Governor.sol +++ b/contracts/governance/Governor.sol @@ -769,7 +769,7 @@ abstract contract Governor is Context, ERC165, EIP712, Nonces, IGovernor, IERC72 // Extract what would be the `#proposer=0x` marker beginning the suffix bytes12 marker; - assembly { + assembly ("memory-safe") { // - Start of the string contents in memory = description + 32 // - First character of the marker = len - 52 // - Length of "#proposer=0x0000000000000000000000000000000000000000" = 52 diff --git a/contracts/metatx/ERC2771Forwarder.sol b/contracts/metatx/ERC2771Forwarder.sol index b5e943d92..b66e7894b 100644 --- a/contracts/metatx/ERC2771Forwarder.sol +++ b/contracts/metatx/ERC2771Forwarder.sol @@ -286,7 +286,7 @@ contract ERC2771Forwarder is EIP712, Nonces { uint256 gasLeft; - assembly { + assembly ("memory-safe") { success := call(reqGas, to, value, add(data, 0x20), mload(data), 0, 0) gasLeft := gas() } diff --git a/contracts/utils/introspection/ERC165Checker.sol b/contracts/utils/introspection/ERC165Checker.sol index da729caf8..a0ac72c21 100644 --- a/contracts/utils/introspection/ERC165Checker.sol +++ b/contracts/utils/introspection/ERC165Checker.sol @@ -113,7 +113,7 @@ library ERC165Checker { bool success; uint256 returnSize; uint256 returnValue; - assembly { + assembly ("memory-safe") { success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20) returnSize := returndatasize() returnValue := mload(0x00)