diff --git a/vyper/builtins/functions.py b/vyper/builtins/functions.py index 2ff03e4266..b5231d8734 100644 --- a/vyper/builtins/functions.py +++ b/vyper/builtins/functions.py @@ -228,6 +228,10 @@ def build_IR(self, expr, context): ADHOC_SLICE_NODE_MACROS = ["~calldata", "~selfcode", "~extcode"] + +# make sure we don't overrun the source buffer, checking for +# overflow: +# valid inputs satisfy: `assert start+length <= src_len && start+length > start` def _make_slice_bounds_check(start, length, src_len): return [ "with", @@ -444,17 +448,6 @@ def build_IR(self, expr, args, kwargs, context): do_copy = copy_bytes(copy_dst, copy_src, copy_len, copy_maxlen) - # make sure we don't overrun the source buffer, checking for - # overflow: - # valid inputs satisfy: `assert start+length <= src_len && start+length > start` - - bounds_check = [ - "with", - "end", - ["add", start, length], - ["assert", ["iszero", ["or", ["gt", "end", src_len], ["lt", "end", start]]]], - ] - ret = [ "seq", _make_slice_bounds_check(start, length, src_len),