From 9190baf2645cf9f04f7d6f1a129340775a8a2403 Mon Sep 17 00:00:00 2001 From: Vectorized Date: Wed, 18 Dec 2024 19:22:21 +0000 Subject: [PATCH] T --- test/LibERC7579.t.sol | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/LibERC7579.t.sol b/test/LibERC7579.t.sol index 9016110b7c..2f70702e80 100644 --- a/test/LibERC7579.t.sol +++ b/test/LibERC7579.t.sol @@ -252,6 +252,34 @@ contract LibERC7579Test is SoladyTest { return pointers.length; } + function testDecodeBatchEdgeCase2() public { + (bool success,) = address(this).call( + abi.encodePacked( + bytes4(keccak256("propose2(bytes32,bytes,uint256)")), + hex"0100000000007821000100000000000000000000000000000000000000000000", + hex"0000000000000000000000000000000000000000000000000000000000000060", // offset to executionData + _randomUniform(), + uint256(32 * 5), // length of executionData (THIS SHOULD ACTUALLY BE 32 * 6 BUT WE REDUCE TO 32 * 5) + hex"0000000000000000000000000000000000000000000000000000000000000020", // offset to pointers array + hex"0000000000000000000000000000000000000000000000000000000000000004", // pointers array length + hex"0000000000000000000000000000000000000000000000000000000000000000", // offset to pointers[0] + hex"0000000000000000000000000000000000000000000000000000000000000000", // offset to pointers[1] + hex"0000000000000000000000000000000000000000000000000000000000000000", // offset to pointers[2] + hex"0000000000000000000000000000000000000000000000000000000000000000" // offset to pointers[3] + ) + ); + assertFalse(success); + } + + function propose2(bytes32, bytes calldata executionData, uint256) + public + pure + returns (uint256) + { + bytes32[] memory pointers = LibERC7579.decodeBatch(executionData); + return pointers.length; + } + function abiDecodeBatch(S calldata s) public pure returns (uint256) { Call[] memory pointers = abi.decode(s.executionData, (Call[])); return pointers.length;