diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 3bbaedde0..d8c6bbb45 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -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)) diff --git a/libsolidity/codegen/YulUtilFunctions.h b/libsolidity/codegen/YulUtilFunctions.h index 2b0450bd1..a0028e5ca 100644 --- a/libsolidity/codegen/YulUtilFunctions.h +++ b/libsolidity/codegen/YulUtilFunctions.h @@ -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 const& _givenTypes, std::vector const& _targetTypes);