aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorpierrenn <git@pnn.sh>2020-03-24 16:17:58 +0900
committerpierrenn <git@pnn.sh>2020-03-27 15:51:05 +0900
commit9ab14e4d21c73d16d8d782f1576fe29e659e2a70 (patch)
treec5c0e040cc880f3faf0806b3748463bc7a133a5d /test
parent97b0687501cee77a9170f9e288755a5d268e9bd4 (diff)
downloadbitcoin-9ab14e4d21c73d16d8d782f1576fe29e659e2a70.tar.xz
Limit decimal range of numbers ParseScript accepts
Diffstat (limited to 'test')
-rw-r--r--test/util/data/bitcoin-util-test.json34
-rw-r--r--test/util/data/txcreatescript5.hex1
-rw-r--r--test/util/data/txcreatescript6.hex1
3 files changed, 36 insertions, 0 deletions
diff --git a/test/util/data/bitcoin-util-test.json b/test/util/data/bitcoin-util-test.json
index 761923a818..16dfa8d77f 100644
--- a/test/util/data/bitcoin-util-test.json
+++ b/test/util/data/bitcoin-util-test.json
@@ -259,6 +259,40 @@
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH, wrapped in a P2SH (output as json)"
},
{ "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:9999999999"],
+ "return_code": 1,
+ "error_txt": "error: script parse error: decimal numeric value only allowed in the range -0xFFFFFFFF...0xFFFFFFFF",
+ "description": "Try to parse an output script with a decimal number above the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:4294967296"],
+ "return_code": 1,
+ "error_txt": "error: script parse error: decimal numeric value only allowed in the range -0xFFFFFFFF...0xFFFFFFFF",
+ "description": "Try to parse an output script with a decimal number just above the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:4294967295"],
+ "output_cmp": "txcreatescript5.hex",
+ "description": "Try to parse an output script with a decimal number at the upper limit of the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:-9999999999"],
+ "return_code": 1,
+ "error_txt": "error: script parse error: decimal numeric value only allowed in the range -0xFFFFFFFF...0xFFFFFFFF",
+ "description": "Try to parse an output script with a decimal number below the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:-4294967296"],
+ "return_code": 1,
+ "error_txt": "error: script parse error: decimal numeric value only allowed in the range -0xFFFFFFFF...0xFFFFFFFF",
+ "description": "Try to parse an output script with a decimal number just below the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
+ "args": ["-create", "outscript=0:-4294967295"],
+ "output_cmp": "txcreatescript6.hex",
+ "description": "Try to parse an output script with a decimal number at the lower limit of the allowed range"
+ },
+ { "exec": "./bitcoin-tx",
"args":
["-create", "nversion=1",
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
diff --git a/test/util/data/txcreatescript5.hex b/test/util/data/txcreatescript5.hex
new file mode 100644
index 0000000000..48e0a12b0c
--- /dev/null
+++ b/test/util/data/txcreatescript5.hex
@@ -0,0 +1 @@
+02000000000100000000000000000605ffffffff0000000000
diff --git a/test/util/data/txcreatescript6.hex b/test/util/data/txcreatescript6.hex
new file mode 100644
index 0000000000..b98293813d
--- /dev/null
+++ b/test/util/data/txcreatescript6.hex
@@ -0,0 +1 @@
+02000000000100000000000000000605ffffffff8000000000