Issue 27931: Email parse IndexError <""@wiarcom.com> (original) (raw)

Created on 2016-09-01 15:29 by Константин Волков, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue27931.patch xiang.zhang,2016-09-02 07:45 review
issue27931.patch r.david.murray,2016-09-10 00:36 review
issue27931_v2.patch xiang.zhang,2016-09-10 05:44 review
Pull Requests
URL Status Linked Edit
PR 5329 merged jayyin11043,2018-01-26 01:51
PR 5431 merged miss-islington,2018-01-29 18:08
Messages (13)
msg274140 - (view) Author: Константин Волков (Константин Волков) Date: 2016-09-01 15:29
Email lib fails to parse some emails: from email._header_value_parser import get_angle_addr get_angle_addr('<""@wiarcom.com> SIZE=28113').addr_spec IndexError: list index out of range Seems that email address can be parsed.
msg274207 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-02 07:45
Looking at the spec this is a valid angle addr. Not only et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].addr_spec but also et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].local_part fails for the same reason. The problem exists in get_bare_quoted_string. When encounter bare '""', it returns a empty BareQuoteString. I write .patch to fix this.
msg274245 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-09-02 14:55
You are correct, it is technically a valid angleaddr. I'll review this next week, the patch looks good (thanks) but I need to double check a couple things before I commit.
msg274260 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-02 17:10
It should be. If there is anything wrong I'd like to hear and fix.
msg275238 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-09 02:41
Ping this and hope you don't forget about it David. :)
msg275513 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-09-10 00:36
Reviewed. There is something else that needs fixing. The address needs to re-render as ""@wiarcom.com, which it doesn't currently. I scanned the rendering code in _header_value_registry quickly and its not obvious to me why it doesn't work, so it may be a bug in the headerregistry.Address object. I'm uploading the patch with the added test.
msg275572 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-10 05:44
You are right David. But I don't understand what it has to do with headerregistry. I update my original patch to get that behaviour, limit it the affection in angleaddr. Now seems everything is fine. >>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].local_part '' >>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].domain 'wiarcom.com' >>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].route >>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].addr_spec '""@wiarcom.com'
msg278839 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-10-18 03:18
Ping.
msg285042 - (view) Author: Константин Волков (Константин Волков) Date: 2017-01-09 13:40
ping
msg307328 - (view) Author: Константин Волков (Константин Волков) Date: 2017-11-30 16:41
ping
msg310761 - (view) Author: Jay Yin (jayyin11043) * Date: 2018-01-26 14:13
https://github.com/python/cpython/pull/5329 this is the pending pull request for this
msg311154 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2018-01-29 18:07
New changeset aa218d1649690d1c1ba86a9972f7fae646bf1a8f by R. David Murray (jayyyin) in branch 'master': bpo-27931: Fix email address header parsing error (#5329) https://github.com/python/cpython/commit/aa218d1649690d1c1ba86a9972f7fae646bf1a8f
msg311187 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-01-29 22:28
New changeset 6ea75b174da0cf824e2acc5db6b53798f5f4e4f9 by Mariatta (Miss Islington (bot)) in branch '3.6': bpo-27931: Fix email address header parsing error (GH-5329) (GH-5431) https://github.com/python/cpython/commit/6ea75b174da0cf824e2acc5db6b53798f5f4e4f9
History
Date User Action Args
2022-04-11 14:58:35 admin set github: 72118
2018-01-30 01:10:30 xiang.zhang set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-01-29 22:28:04 Mariatta set nosy: + Mariattamessages: +
2018-01-29 18:08:04 miss-islington set pull_requests: + <pull%5Frequest5266>
2018-01-29 18:07:47 r.david.murray set messages: +
2018-01-26 14:13:42 jayyin11043 set nosy: + jayyin11043messages: +
2018-01-26 03🔞49 xiang.zhang set type: behaviorversions: + Python 3.7, - Python 3.5
2018-01-26 01:51:02 jayyin11043 set stage: commit review -> patch reviewpull_requests: + <pull%5Frequest5174>
2017-11-30 16:41:51 Константин Волков set messages: +
2017-01-09 13:40:51 Константин Волков set messages: +
2016-10-18 03🔞00 xiang.zhang set messages: +
2016-09-10 05:44:20 xiang.zhang set files: + issue27931_v2.patchmessages: +
2016-09-10 00:36:58 r.david.murray set files: + issue27931.patchmessages: +
2016-09-09 02:41:22 xiang.zhang set messages: +
2016-09-02 17:10:11 xiang.zhang set messages: +
2016-09-02 14:55:02 r.david.murray set assignee: r.david.murraymessages: + stage: needs patch -> commit review
2016-09-02 07:45:15 xiang.zhang set files: + issue27931.patchnosy: + xiang.zhangmessages: + keywords: + patch
2016-09-01 15:41:03 r.david.murray set stage: needs patchversions: + Python 3.6
2016-09-01 15:29:39 Константин Волков create