Changeset View
Changeset View
Standalone View
Standalone View
src/core_read.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | for (const auto &w : words) { | ||||
next_push_size = 0; | next_push_size = 0; | ||||
// Decimal numbers | // Decimal numbers | ||||
if (std::all_of(w.begin(), w.end(), ::IsDigit) || | if (std::all_of(w.begin(), w.end(), ::IsDigit) || | ||||
(w.front() == '-' && w.size() > 1 && | (w.front() == '-' && w.size() > 1 && | ||||
std::all_of(w.begin() + 1, w.end(), ::IsDigit))) { | std::all_of(w.begin() + 1, w.end(), ::IsDigit))) { | ||||
// Number | // Number | ||||
int64_t n = atoi64(w); | int64_t n = atoi64(w); | ||||
// limit the range of numbers ParseScript accepts in decimal | |||||
// since numbers outside -0xFFFFFFFF...0xFFFFFFFF are illegal in | |||||
// scripts | |||||
if (n > int64_t{0xffffffff} || n < -1 * int64_t{0xffffffff}) { | |||||
throw std::runtime_error("script parse error: decimal numeric " | |||||
"value only allowed in the " | |||||
"range -0xFFFFFFFF...0xFFFFFFFF"); | |||||
} | |||||
result << n; | result << n; | ||||
goto next; | goto next; | ||||
} | } | ||||
// Hex Data | // Hex Data | ||||
if (w.substr(0, 2) == "0x" && w.size() > 2) { | if (w.substr(0, 2) == "0x" && w.size() > 2) { | ||||
if (!IsHex(std::string(w.begin() + 2, w.end()))) { | if (!IsHex(std::string(w.begin() + 2, w.end()))) { | ||||
// Should only arrive here for improperly formatted hex values | // Should only arrive here for improperly formatted hex values | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |