integer-encoding-rs
integer-encoding-rs copied to clipboard
fix: decode returns `None` with u64::MAX + 1
Rationale
[0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x02]
is the encoding of u64::MAX
.
This does not return None
when decoding even though it should.
This PR fixes this issue.
Changes
-
u64::decode_var
now returnsNone
when a 10th byte is used but is more than1
. - A test is added for the above case.