fix: infinite loop when decoding invalid 2231 charset
This commit is contained in:
parent
813e99f399
commit
0b0991d682
|
@ -40,6 +40,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||
* Issue causing deadlock when reloading users keys due to double-locking of a mutex.
|
||||
* Correctly handle failure to unlock single key.
|
||||
* GODT-479 Fix flaky integration tests.
|
||||
* GODT-484 Fix infinite loop when decoding invalid 2231 charset
|
||||
|
||||
## [v1.2.7] Donghai-hotfix - beta (2020-05-07)
|
||||
|
||||
|
|
|
@ -107,6 +107,11 @@ func TestParseMediaType(t *testing.T) {
|
|||
wantMediaType: "attachment",
|
||||
wantParams: map[string]string{"filename": "備a忘b錄.m4a", "title": "memorandum"},
|
||||
},
|
||||
"Bad2231EncodingKeepsJustTitle": {
|
||||
arg: "attachment;\nfilename*=utf-8'%F0%9F%98%81%F0%9F%98%82.txt;\n title=smile",
|
||||
wantMediaType: "attachment",
|
||||
wantParams: map[string]string{"title": "smile"},
|
||||
},
|
||||
}
|
||||
for name, testData := range testTable {
|
||||
t.Run(name, testData.run)
|
||||
|
|
|
@ -69,6 +69,7 @@ func changeEncodingAndKeepLastParamDefinition(v string) (out string, err error)
|
|||
charset, _, err := get2231Charset(value)
|
||||
if err != nil {
|
||||
log.Errorln("Filter params:", err)
|
||||
v = rest
|
||||
continue
|
||||
}
|
||||
if charset != "utf-8" && charset != "us-ascii" {
|
||||
|
|
Loading…
Reference in New Issue