mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Revert on failing read from calldata.
This commit is contained in:
parent
f8d5c4db36
commit
8b96d17cb5
@ -2552,7 +2552,7 @@ string YulUtilFunctions::cleanupFunction(Type const& _type)
|
||||
case Type::Category::Enum:
|
||||
{
|
||||
// Out of range enums cannot be truncated unambigiously and therefore it should be an error.
|
||||
templ("body", "cleaned := value " + validatorFunction(_type) + "(value)");
|
||||
templ("body", "cleaned := value " + validatorFunction(_type, false) + "(value)");
|
||||
break;
|
||||
}
|
||||
case Type::Category::InaccessibleDynamic:
|
||||
@ -3057,7 +3057,7 @@ string YulUtilFunctions::readFromMemoryOrCalldata(Type const& _type, bool _fromC
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("fromCalldata", _fromCalldata)
|
||||
("validate", validatorFunction(_type))
|
||||
("validate", validatorFunction(_type, true))
|
||||
// Byte array elements generally need cleanup.
|
||||
// Other types are cleaned as well to account for dirty memory e.g. due to inline assembly.
|
||||
("cleanup", cleanupFunction(_type))
|
||||
|
@ -347,7 +347,7 @@ public:
|
||||
/// otherwise an assertion failure.
|
||||
///
|
||||
/// This is used for data decoded from external sources.
|
||||
std::string validatorFunction(Type const& _type, bool _revertOnFailure = false);
|
||||
std::string validatorFunction(Type const& _type, bool _revertOnFailure);
|
||||
|
||||
std::string packedHashFunction(std::vector<Type const*> const& _givenTypes, std::vector<Type const*> const& _targetTypes);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user