net/textproto: NewConn fails to initialize commonHeader prior to use #46363
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In this case, the canonicalMimeHeader map is uninitialized. If i would use textproto.NewReader() this map is correctly initialized using the sync.Once mechanism.
ReadMIMEHeader() uses canonicalMIMEHeaderKey() which doesn't initialize the map. If you use the public function CanonicalMIMEHeaderKey() then the map is correctly initialized.
This should fix it:
But i believe this is a better solution: https://go-review.googlesource.com/c/go/+/170317/
What did you expect to see?
No fatal error or data race.
What did you see instead?
(We forked net/textproto to better debug it but it's basically the same)
The text was updated successfully, but these errors were encountered: