|
|
@ -14,6 +14,7 @@ |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
#include <vector> |
|
|
|
#include <vector> |
|
|
|
|
|
|
|
#include "crypto/common.h" |
|
|
|
|
|
|
|
|
|
|
|
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
|
|
|
|
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
|
|
|
|
|
|
|
|
|
|
|
@ -416,14 +417,16 @@ public: |
|
|
|
else if (b.size() <= 0xffff) |
|
|
|
else if (b.size() <= 0xffff) |
|
|
|
{ |
|
|
|
{ |
|
|
|
insert(end(), OP_PUSHDATA2); |
|
|
|
insert(end(), OP_PUSHDATA2); |
|
|
|
unsigned short nSize = b.size(); |
|
|
|
uint8_t data[2]; |
|
|
|
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize)); |
|
|
|
WriteLE16(data, b.size()); |
|
|
|
|
|
|
|
insert(end(), data, data + sizeof(data)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
insert(end(), OP_PUSHDATA4); |
|
|
|
insert(end(), OP_PUSHDATA4); |
|
|
|
unsigned int nSize = b.size(); |
|
|
|
uint8_t data[4]; |
|
|
|
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize)); |
|
|
|
WriteLE32(data, b.size()); |
|
|
|
|
|
|
|
insert(end(), data, data + sizeof(data)); |
|
|
|
} |
|
|
|
} |
|
|
|
insert(end(), b.begin(), b.end()); |
|
|
|
insert(end(), b.begin(), b.end()); |
|
|
|
return *this; |
|
|
|
return *this; |
|
|
@ -496,15 +499,14 @@ public: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (end() - pc < 2) |
|
|
|
if (end() - pc < 2) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
nSize = 0; |
|
|
|
nSize = ReadLE16(&pc[0]); |
|
|
|
memcpy(&nSize, &pc[0], 2); |
|
|
|
|
|
|
|
pc += 2; |
|
|
|
pc += 2; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (opcode == OP_PUSHDATA4) |
|
|
|
else if (opcode == OP_PUSHDATA4) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (end() - pc < 4) |
|
|
|
if (end() - pc < 4) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
memcpy(&nSize, &pc[0], 4); |
|
|
|
nSize = ReadLE32(&pc[0]); |
|
|
|
pc += 4; |
|
|
|
pc += 4; |
|
|
|
} |
|
|
|
} |
|
|
|
if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize) |
|
|
|
if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize) |
|
|
|