File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -90,12 +90,14 @@ contract EIP7702Proxy is Proxy {
9090 }
9191 }
9292
93- // Otherwise try ecrecover
94- address recovered = ECDSA.recover (hash, signature);
95- if (recovered == address (this )) {
96- assembly {
97- mstore (0 , ERC1271_MAGIC_VALUE )
98- return (0 , 32 )
93+ // Only try ECDSA if signature is the right length (65 bytes)
94+ if (signature.length == 65 ) {
95+ address recovered = ECDSA.recover (hash, signature);
96+ if (recovered == address (this )) {
97+ assembly {
98+ mstore (0 , ERC1271_MAGIC_VALUE )
99+ return (0 , 32 )
100+ }
99101 }
100102 }
101103
Original file line number Diff line number Diff line change @@ -102,7 +102,11 @@ contract IsValidSignatureTest is EIP7702ProxyBase {
102102 function testEmptySignature () public {
103103 bytes memory emptySignature = "" ;
104104
105- vm.expectRevert ();
106105 bytes4 result = wallet.isValidSignature (testHash, emptySignature);
106+ assertEq (
107+ result,
108+ ERC1271_FAIL_VALUE ,
109+ "Should reject empty signature "
110+ );
107111 }
108112}
You can’t perform that action at this time.
0 commit comments