https://go-review.googlesource.com/37812 says fix panic parsing.
Actually, it doesn't. so fix it.
Fixes #19416
Change-Id: Ie0c4241f10e5ebcbac20e184c2a7b13b22632eab
Reviewed-on: https://go-review.googlesource.com/37912
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
if len(charset) == 0 {
return "", errInvalidWord
}
+ if len(word) <= split+3 {
+ return "", errInvalidWord
+ }
encoding := word[split+1]
// the field after split must only be one byte
if word[split+2] != '?' {
return "", errInvalidWord
}
text := word[split+3:]
- if len(text) == 0 {
- return "", errInvalidWord
- }
content, err := decode(encoding, text)
if err != nil {
{"=?UTF-8?A?A?=", "", true},
{"=????=", "", true},
{"=?UTF-8?Q??=", "", true},
+ {"=?UTF-8???=", "", true},
}
for _, test := range tests {