aboutsummaryrefslogtreecommitdiffstats
path: root/common/hexutil/json_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-02-23 00:35:11 +0800
committerFelix Lange <fjl@twurst.com>2017-03-02 21:05:46 +0800
commitf3b7dcc5bdd5b2b02e12133a0d8e16a75844f766 (patch)
tree8ec56c1b7e2aa996184a8b8c5f1a1d9eefb4f92b /common/hexutil/json_test.go
parentc52ab932e61ef9eba37c107e8b58b22c7d32e6c2 (diff)
downloaddexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar.gz
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar.bz2
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar.lz
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar.xz
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.tar.zst
dexon-f3b7dcc5bdd5b2b02e12133a0d8e16a75844f766.zip
common/hexutil: reject big integer inputs > 256 bits
This follows the change to common/math big integer parsing in PR #3699.
Diffstat (limited to 'common/hexutil/json_test.go')
-rw-r--r--common/hexutil/json_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/hexutil/json_test.go b/common/hexutil/json_test.go
index 290bf9ca2..c7fde0adb 100644
--- a/common/hexutil/json_test.go
+++ b/common/hexutil/json_test.go
@@ -130,6 +130,10 @@ var unmarshalBigTests = []unmarshalTest{
{input: `"0x01"`, wantErr: ErrLeadingZero},
{input: `"0xx"`, wantErr: ErrSyntax},
{input: `"0x1zz01"`, wantErr: ErrSyntax},
+ {
+ input: `"0x10000000000000000000000000000000000000000000000000000000000000000"`,
+ wantErr: ErrBig256Range,
+ },
// valid encoding
{input: `""`, want: big.NewInt(0)},
@@ -148,6 +152,10 @@ var unmarshalBigTests = []unmarshalTest{
input: `"0xffffffffffffffffffffffffffffffffffff"`,
want: referenceBig("ffffffffffffffffffffffffffffffffffff"),
},
+ {
+ input: `"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"`,
+ want: referenceBig("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
+ },
}
func TestUnmarshalBig(t *testing.T) {