mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
fix: infinite loop when decoding invalid 2231 charset
This commit is contained in:
@ -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.
|
* Issue causing deadlock when reloading users keys due to double-locking of a mutex.
|
||||||
* Correctly handle failure to unlock single key.
|
* Correctly handle failure to unlock single key.
|
||||||
* GODT-479 Fix flaky integration tests.
|
* 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)
|
## [v1.2.7] Donghai-hotfix - beta (2020-05-07)
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,11 @@ func TestParseMediaType(t *testing.T) {
|
|||||||
wantMediaType: "attachment",
|
wantMediaType: "attachment",
|
||||||
wantParams: map[string]string{"filename": "備a忘b錄.m4a", "title": "memorandum"},
|
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 {
|
for name, testData := range testTable {
|
||||||
t.Run(name, testData.run)
|
t.Run(name, testData.run)
|
||||||
|
|||||||
@ -69,6 +69,7 @@ func changeEncodingAndKeepLastParamDefinition(v string) (out string, err error)
|
|||||||
charset, _, err := get2231Charset(value)
|
charset, _, err := get2231Charset(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln("Filter params:", err)
|
log.Errorln("Filter params:", err)
|
||||||
|
v = rest
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if charset != "utf-8" && charset != "us-ascii" {
|
if charset != "utf-8" && charset != "us-ascii" {
|
||||||
|
|||||||
Reference in New Issue
Block a user