network: allow larger extensible payload
This commit is contained in:
parent
664a2a88eb
commit
3fed06989a
2 changed files with 9 additions and 1 deletions
|
@ -65,7 +65,7 @@ func (e *Extensible) decodeBinaryUnsigned(r *io.BinReader) {
|
|||
e.ValidBlockStart = r.ReadU32LE()
|
||||
e.ValidBlockEnd = r.ReadU32LE()
|
||||
r.ReadBytes(e.Sender[:])
|
||||
e.Data = r.ReadVarBytes(maxExtensibleDataSize)
|
||||
e.Data = r.ReadVarBytes(MaxSize)
|
||||
}
|
||||
|
||||
// DecodeBinary implements io.Serializable.
|
||||
|
|
|
@ -41,6 +41,14 @@ func TestExtensible_Serializable(t *testing.T) {
|
|||
err := testserdes.DecodeBinary(append(unsigned, 42), new(Extensible))
|
||||
require.True(t, errors.Is(err, errInvalidPadding))
|
||||
})
|
||||
t.Run("too large data size", func(t *testing.T) {
|
||||
expected.Data = make([]byte, MaxSize+1)
|
||||
w := io.NewBufBinWriter()
|
||||
expected.encodeBinaryUnsigned(w.BinWriter)
|
||||
unsigned = w.Bytes()
|
||||
err := testserdes.DecodeBinary(unsigned, new(Extensible))
|
||||
require.NotNil(t, err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue