diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -332,14 +332,27 @@ return set_error(serror, SCRIPT_ERR_OP_COUNT); } - if (opcode == OP_CAT || opcode == OP_SPLIT || - opcode == OP_NUM2BIN || opcode == OP_BIN2NUM || - opcode == OP_INVERT || opcode == OP_AND || opcode == OP_OR || - opcode == OP_XOR || opcode == OP_2MUL || opcode == OP_2DIV || - opcode == OP_MUL || opcode == OP_DIV || opcode == OP_MOD || - opcode == OP_LSHIFT || opcode == OP_RSHIFT) { - // Disabled opcodes. - return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); + // Some opcodes are disabled. + switch (opcode) { + case OP_CAT: + case OP_SPLIT: + case OP_BIN2NUM: + case OP_NUM2BIN: + case OP_INVERT: + case OP_AND: + case OP_OR: + case OP_XOR: + case OP_2MUL: + case OP_2DIV: + case OP_MUL: + case OP_DIV: + case OP_MOD: + case OP_LSHIFT: + case OP_RSHIFT: + return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); + + default: + break; } if (fExec && 0 <= opcode && opcode <= OP_PUSHDATA4) { @@ -348,7 +361,7 @@ return set_error(serror, SCRIPT_ERR_MINIMALDATA); } stack.push_back(vchPushValue); - } else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF)) + } else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF)) { switch (opcode) { // // Push value @@ -1180,6 +1193,7 @@ default: return set_error(serror, SCRIPT_ERR_BAD_OPCODE); } + } // Size limits if (stack.size() + altstack.size() > 1000) { diff --git a/src/script/script.h b/src/script/script.h --- a/src/script/script.h +++ b/src/script/script.h @@ -175,7 +175,7 @@ OP_NOP9 = 0xb8, OP_NOP10 = 0xb9, - // the first op_code value after all defined opcodes + // The first op_code value after all defined opcodes FIRST_UNDEFINED_OP_VALUE, // template matching params