aboutsummaryrefslogtreecommitdiff
path: root/src/core_read.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core_read.cpp')
-rw-r--r--src/core_read.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp
index 9a65b02585..d036955641 100644
--- a/src/core_read.cpp
+++ b/src/core_read.cpp
@@ -59,6 +59,14 @@ CScript ParseScript(const std::string& s)
{
// Number
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;
}
else if (w->substr(0,2) == "0x" && w->size() > 2 && IsHex(std::string(w->begin()+2, w->end())))