Skip to content

Commit 3a83666

Browse files
fix[codegen]: fix abi_encode buffer size in external calls (#4202)
fix the buffer size passed to the abi encoder from the external call argument packer. previously, the size was overestimated as it didn't take into account pointer arithmetic performed on the buffer passed to abi_encode. this is a hygienic fix, no security implications were found for this issue. --------- Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
1 parent c0cf436 commit 3a83666

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vyper/codegen/external_call.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def _pack_arguments(fn_type, args, context):
7171
pack_args.append(["mstore", buf, util.method_id_int(abi_signature)])
7272

7373
if len(args) != 0:
74-
pack_args.append(abi_encode(add_ofst(buf, 32), args_as_tuple, context, bufsz=buflen))
74+
encode_buf = add_ofst(buf, 32)
75+
encode_buflen = buflen - 32
76+
pack_args.append(abi_encode(encode_buf, args_as_tuple, context, bufsz=encode_buflen))
7577

7678
return buf, pack_args, args_ofst, args_len
7779

0 commit comments

Comments
 (0)