Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/binary: ReadUvarint does not report io.ErrUnexpectedEOF #54139

Closed
dsnet opened this issue Jul 30, 2022 · 2 comments
Closed

encoding/binary: ReadUvarint does not report io.ErrUnexpectedEOF #54139

dsnet opened this issue Jul 30, 2022 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.

Comments

@dsnet
Copy link
Member

dsnet commented Jul 30, 2022

If ReadUvarint reads at least 1 byte, it should convert any io.EOF encountered into an io.ErrUnexpectedEOF. Otherwise, the caller cannot distinguish whether the input was truncated or not.

The user could try and check whether the returned number was non-zero, but that doesn't work for a situation where the varint is denormalized zero.

@gopherbot
Copy link

Change https://go.dev/cl/420274 mentions this issue: encoding/binary: ReadUvarint return io.ErrUnexpectedEOF when read at least 1 byte

@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 30, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Jul 31, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 5, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 8, 2022
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
…least 1 byte

Fixes golang#54139

Change-Id: Ifc73bd7f181b13970ee6a08968f9d8f6e55d7ff3
GitHub-Last-Rev: 1e0a79b
GitHub-Pull-Request: golang#54143
Reviewed-on: https://go-review.googlesource.com/c/go/+/420274
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/450280 mentions this issue: go1.20: add release notes for archive/zip, encoding/binary, mime

gopherbot pushed a commit that referenced this issue Nov 15, 2022
For #48866
For #54139
For #54801

Change-Id: Iafe72ccc7e756ec1edb5bb7e8e90d385458cff29
Reviewed-on: https://go-review.googlesource.com/c/go/+/450280
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@golang golang locked and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants