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

x/text: transform.String() can allocate unlimited memory when called with a buggy transformer returning ErrShortSrc #39490

Closed
abacabadabacaba opened this issue Jun 9, 2020 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@abacabadabacaba
Copy link

Some transform.Transformers are buggy and return ErrShortSrc even when they shouldn't (e.g. when atEOF = true). When passed such a transformer, transform.String() will allocate more and more memory until it runs out of memory and crashes. Due to a separate bug, UTF-16 decoder from the same library can behave in such way, so this code can be used to reproduce this bug:

package main

import "golang.org/x/text/encoding/unicode"

func main() {
	unicode.UTF16(unicode.BigEndian, unicode.UseBOM).NewDecoder().String(" ")
}
@gopherbot gopherbot added this to the Unreleased milestone Jun 9, 2020
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 15, 2020
@abacabadabacaba
Copy link
Author

@golang golang locked and limited conversation to collaborators Jun 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants