encoding/binary: Read(U)varint should return ErrUnexpectedEOF #33575
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?Description
binary.ReadUvarint
andbinary.ReadVarint
currently returnio.EOF
when they encounter an EOF halfway to reading a varint.This:
if err != nil { return err }
pattern. In this case, they'll return an EOF which usually signals "we're done", not "we read some bad data".EOF documentation:
ErrUnexpectedEOF documentation:
Unfortunately, as pointed out by @ianlancetaylor, fixing this would technically be an API-breaking change.
The text was updated successfully, but these errors were encountered: