@@ -68,6 +68,12 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
68
68
/// @dev The account's {fallback} was called with a selector that doesn't have an installed handler.
69
69
error ERC7579MissingFallbackHandler (bytes4 selector );
70
70
71
+ /// @dev The provided initData/deInitData for a fallback module is too short to extract a selector.
72
+ error ERC7579CannotDecodeFallbackData ();
73
+
74
+ /// @dev The provided signature is not long enough to be parsed as a module signature.
75
+ error ERC7579InvalidModuleSignature ();
76
+
71
77
/// @dev Modifier that checks if the caller is an installed module of the given type.
72
78
modifier onlyModule (uint256 moduleTypeId , bytes calldata additionalContext ) {
73
79
_checkModule (moduleTypeId, msg .sender , additionalContext);
@@ -384,7 +390,8 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
384
390
function _extractSignatureValidator (
385
391
bytes calldata signature
386
392
) internal pure virtual returns (address module , bytes calldata innerSignature ) {
387
- return (address (bytes20 (signature[0 :20 ])), signature[20 :]);
393
+ require (signature.length > 19 , ERC7579InvalidModuleSignature ());
394
+ return (address (bytes20 (signature)), signature[20 :]);
388
395
}
389
396
390
397
/**
@@ -399,6 +406,7 @@ abstract contract AccountERC7579 is Account, IERC1271, IERC7579Execution, IERC75
399
406
function _decodeFallbackData (
400
407
bytes memory data
401
408
) internal pure virtual returns (bytes4 selector , bytes memory remaining ) {
409
+ require (data.length > 3 , ERC7579CannotDecodeFallbackData ());
402
410
return (bytes4 (data), data.slice (4 ));
403
411
}
404
412
0 commit comments