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:
@ -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{
|
||||
|
Reference in New Issue
Block a user