common/hexutil: reject big integer inputs > 256 bits

This follows the change to common/math big integer parsing in PR #3699.
This commit is contained in:
Felix Lange
2017-02-22 17:35:11 +01:00
parent c52ab932e6
commit f3b7dcc5bd
4 changed files with 30 additions and 3 deletions

View File

@ -83,6 +83,10 @@ var (
{input: `0x01`, wantErr: ErrLeadingZero},
{input: `0xx`, wantErr: ErrSyntax},
{input: `0x1zz01`, wantErr: ErrSyntax},
{
input: `0x10000000000000000000000000000000000000000000000000000000000000000`,
wantErr: ErrBig256Range,
},
// valid
{input: `0x0`, want: big.NewInt(0)},
{input: `0x2`, want: big.NewInt(0x2)},
@ -99,6 +103,10 @@ var (
input: `0xffffffffffffffffffffffffffffffffffff`,
want: referenceBig("ffffffffffffffffffffffffffffffffffff"),
},
{
input: `0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`,
want: referenceBig("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
},
}
decodeUint64Tests = []unmarshalTest{