-
Notifications
You must be signed in to change notification settings - Fork 117
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
Issue in x/text may casue OOM crash when parsing message #95
Comments
I think this ought to be fixed upstream. I don't want to provide workarounds for Go stdlib bugs. |
It should be fixed upstream and then applications that are concerned should be built with fixed Go version. Depending on how hard the upstream bug to fix is we might actually want to disable the affected encoding in meanwhile since the issue is already public. |
Footnote: It is possible for application developers to do so by calling |
I think that issue can be closed then. I was surprised that issue in x/text causing oom crash is known for more than half of a year and still can be triggered even with go playground. |
Thinking about it, since go-message/charset does provide the list of charsets, I think I'd accept a patch temporarily disabling this charset in this package. |
Upstream go's x/text/encoding package has a bug that makes the 'hz-gb-2312' encoding crash (golang/go#35118) This was reported to go-message in emersion#95 This commit removes the offending encoding so that go-message can't crash if people import the charset package. It should be reverted once the upstream package is fixed by the go developers.
Upstream go's x/text/encoding package has a bug that makes the 'hz-gb-2312' encoding crash (golang/go#35118) This was reported to go-message in emersion#95 This commit removes the offending encoding so that go-message can't crash if people import the charset package. It should be reverted once the upstream package is fixed by the go developers.
Upstream go's x/text/encoding package has a bug that makes the 'hz-gb-2312' encoding crash (golang/go#35118) This was reported to go-message in #95 This commit removes the offending encoding so that go-message can't crash if people import the charset package. It should be reverted once the upstream package is fixed by the go developers.
The upstream Go issue has been fixed [1]. [1]: golang/go#35118 References: #95
The charset has been re-enabled now that the upstream issue is fixed. |
Parsing input like
May cause OOM crash due to golang/go#35118 (opened at Oct 23, 2019)
Reproduce steps
go version go1.14.2 linux/amd64
go mod init github.com/teawithsand/blah
github.com/emersion/go-message
go run .
This code triggers buggy path in golang.org/x/text and causes OOM crash.
Should this library include this fix to prevent users from shooting themselves in a foot and forbid using
hz-gb-2312
encoding? Or maybe some notice about such problem would be nice.IMO this behavior is too much surprising(AKA unexpected) to just leave it as is.
Proposed fix(in
charset/charset.go
)Just before return line insert:
I've used replace in go mod to test it and code similar to above and it turns out to workaround issue.
go.mod
go.sum
The text was updated successfully, but these errors were encountered: