diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -782,6 +782,39 @@ // Disabled opcodes. return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); } + // (x1 x2 - out) + if (stack.size() < 2) { + return set_error( + serror, SCRIPT_ERR_INVALID_STACK_OPERATION); + } + valtype &vch1 = stacktop(-2); + valtype &vch2 = stacktop(-1); + // throw error if inputs are not the same size + if (vch1.size() != vch2.size()) { + return set_error( + serror, SCRIPT_ERR_INVALID_BITWISE_LENGTH); + } + + switch (opcode) { + case OP_AND: + for (size_t i=0; i