File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -796,6 +796,10 @@ void ProtoConverter::visit(CopyFunc const& _x)
796796 if (type == CopyFunc::RETURNDATA && !m_evmVersion.supportsReturndata ())
797797 return ;
798798
799+ // Bail out if MCOPY is not supported for fuzzed EVM version
800+ if (type == CopyFunc::MEMORY && !m_evmVersion.hasMcopy ())
801+ return ;
802+
799803 // Code copy may change state if e.g., some byte of code
800804 // is stored to storage via a sequence of mload and sstore.
801805 if (m_filterStatefulInstructions && type == CopyFunc::CODE)
@@ -816,13 +820,22 @@ void ProtoConverter::visit(CopyFunc const& _x)
816820 case CopyFunc::DATA:
817821 m_output << " datacopy" ;
818822 break ;
823+ case CopyFunc::MEMORY:
824+ m_output << " mcopy" ;
819825 }
820826 m_output << " (" ;
821827 m_output << " mod(" ;
822828 visit (_x.target ());
823829 m_output << " , " << to_string (s_maxMemory - s_maxSize) << " )" ;
824830 m_output << " , " ;
825- visit (_x.source ());
831+ if (type == CopyFunc::MEMORY)
832+ {
833+ m_output << " mod(" ;
834+ visit (_x.source ());
835+ m_output << " , " << to_string (s_maxMemory - s_maxSize) << " )" ;
836+ }
837+ else
838+ visit (_x.source ());
826839 m_output << " , " ;
827840 m_output << " mod(" ;
828841 visit (_x.size ());
Original file line number Diff line number Diff line change @@ -346,7 +346,9 @@ class ProtoConverter
346346 static auto constexpr s_dataIdentifier = " datablock" ;
347347 // / Upper bound on memory writes is 64KB in order to
348348 // / preserve semantic equivalence in the presence of
349- // / memory guard
349+ // / memory guard. Note that s_maxMemory must be much larger
350+ // / than s_maxSize to create tests without significant overlap
351+ // / of I/O memory regions.
350352 static unsigned constexpr s_maxMemory = 65536 ;
351353 // / Upper bound on size for range copy functions
352354 static unsigned constexpr s_maxSize = 32768 ;
Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ message CopyFunc {
186186 CODE = 1 ;
187187 RETURNDATA = 2 ;
188188 DATA = 3 ;
189+ MEMORY = 4 ;
189190 }
190191 required CopyType ct = 1 ;
191192 required Expression target = 2 ;
You can’t perform that action at this time.
0 commit comments