Author: Johnson Lau 2017-01-03 03:39:19
Published on: 2017-01-03T03:39:19+00:00
A script in bitcoin using opcodes is limited to a maximum of 201. For instance, if there were to be 198 OP_2DUP used in a script, the size would be 206kB. The op_dup/op_cat style bug could cause out of memory errors under a similar script. A participant on a mailing list for bitcoin developers asked about the potential attack vector of using a pk_script with [op_2dup, op_2dup, op_2dup, op_2dup, op_2dup, ...(to limit)..., op_2dup, op_hash160, , op_equalverify, op_checksig], which still appeared valid. However, the MAX_SCRIPT_ELEMENT_SIZE is 520 bytes, which would limit the returned item of the op_cat opcode. The worst-case scenario for this script would be approximately 10 MB.
Updated on: 2023-05-20T00:31:28.532017+00:00