[#356] refs: Handle uint32 overflow in SubnetID text format

Clarify the bit size limit in `SubnetID.UnmarshalText` method. Cover
overflow case in unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-22 12:34:09 +03:00 committed by LeL
parent 4560e447e1
commit dc292864aa
2 changed files with 13 additions and 1 deletions

View file

@ -199,7 +199,9 @@ func (s *SubnetID) MarshalText() ([]byte, error) {
}
// UnmarshalText decodes SubnetID from the text according to NeoFS API V2 protocol:
// should be base-10 integer string format.
// should be base-10 integer string format with bitsize = 32.
//
// Returns strconv.ErrRange if integer overflows uint32.
//
// Must not be called on nil.
//