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/gob: cannot decode large []string #59172

Closed
RandomSort opened this issue Mar 21, 2023 · 3 comments
Closed

encoding/gob: cannot decode large []string #59172

RandomSort opened this issue Mar 21, 2023 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@RandomSort
Copy link
Contributor

What version of Go are you using (go version)?

$ go version

1.20.2

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="linux"

What did you do?

If you try to decode a []string larger than 655360 using encoding/gob, you get a panic as the slice helpers introduced in 1.20 did not extend the stringslice helper.

https://go.dev/play/p/Xe0ajfykrSm?v=goprev (thanks to Jacob Oaks)

What did you expect to see?

Successful decoding (https://go.dev/play/p/Xe0ajfykrSm?v=goprev ) <- 1.19

What did you see instead?

Panic (https://go.dev/play/p/Xe0ajfykrSm) <- 1.20

RandomSort added a commit to RandomSort/go that referenced this issue Mar 21, 2023
There is a bug in the current implementation where
very large `[]string` will not be extended, causing an
index out of bounds panic.

Fixes golang#59172
@gopherbot
Copy link

Change https://go.dev/cl/478215 mentions this issue: encoding/gob: Extend partially allocated string slices

RandomSort added a commit to RandomSort/go that referenced this issue Mar 22, 2023
There is a bug in the current implementation where
very large `[]string` will not be extended, causing an
index out of bounds panic.

Fixes golang#59172
@heschi heschi changed the title encoding/gob: encoding/gob: cannot decode large []string Mar 22, 2023
@heschi
Copy link
Contributor

heschi commented Mar 22, 2023

cc @robpike

@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 22, 2023
@heschi heschi added this to the Go1.21 milestone Mar 22, 2023
@ianlancetaylor
Copy link
Contributor

FYI this was a mistake on my part, in CL 443777, and there is already an approved CL to fix it.

@golang golang locked and limited conversation to collaborators Mar 22, 2024
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.

4 participants