From e35ddbc41c76364fa879a1b8a9deae9dbadfd9ca Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 6 Apr 2021 13:04:17 +0200 Subject: [PATCH] yul fuzzer: Permit upto 7 I/O function parameters (previously 4). --- test/tools/ossfuzz/protoToYul.cpp | 12 ++++++++++++ test/tools/ossfuzz/protoToYul.h | 4 ++-- test/tools/ossfuzz/yulProto.proto | 14 ++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index c58a56ad2..6c9e2862d 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -869,6 +869,18 @@ void ProtoConverter::visitFunctionInputParams(FunctionCall const& _x, unsigned _ // We reverse the order of function input visits since it helps keep this switch case concise. switch (_numInputParams) { + case 7: + visit(_x.in_param7()); + m_output << ", "; + [[fallthrough]]; + case 6: + visit(_x.in_param6()); + m_output << ", "; + [[fallthrough]]; + case 5: + visit(_x.in_param5()); + m_output << ", "; + [[fallthrough]]; case 4: visit(_x.in_param4()); m_output << ", "; diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 9100b490c..ca5f6582e 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -340,8 +340,8 @@ private: /// Map of object name to list of sub-object namespace(s) in scope std::map> m_objectScope; // mod input/output parameters impose an upper bound on the number of input/output parameters a function may have. - static unsigned constexpr s_modInputParams = 5; - static unsigned constexpr s_modOutputParams = 5; + static unsigned constexpr s_modInputParams = 8; + static unsigned constexpr s_modOutputParams = 8; /// Hard-coded identifier for a Yul object's data block static auto constexpr s_dataIdentifier = "datablock"; /// Predicate to keep track of for body scope. If false, break/continue diff --git a/test/tools/ossfuzz/yulProto.proto b/test/tools/ossfuzz/yulProto.proto index bb2f1170a..30306c4c6 100644 --- a/test/tools/ossfuzz/yulProto.proto +++ b/test/tools/ossfuzz/yulProto.proto @@ -62,10 +62,16 @@ message FunctionCall { required Expression in_param2 = 2; required Expression in_param3 = 3; required Expression in_param4 = 4; - required VarRef out_param1 = 5; - required VarRef out_param2 = 6; - required VarRef out_param3 = 7; - required VarRef out_param4 = 8; + required Expression in_param5 = 5; + required Expression in_param6 = 6; + required Expression in_param7 = 7; + required VarRef out_param1 = 8; + required VarRef out_param2 = 9; + required VarRef out_param3 = 10; + required VarRef out_param4 = 11; + required Expression out_param5 = 12; + required Expression out_param6 = 13; + required Expression out_param7 = 14; } message TypedVarDecl {