Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9c957f

Browse files
committed
Merged revisions 85142 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r85142 | r.david.murray | 2010-10-01 11:40:20 -0400 (Fri, 01 Oct 2010) | 5 lines #10004: in Q encoded word ignore '=xx' when xx is not valid hex. Bug report and fix by Thomas Guettler. ........
1 parent eccd4d9 commit f9c957f

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lib/email/quoprimime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,4 @@ def header_decode(s):
294294
the high level email.Header class for that functionality.
295295
"""
296296
s = s.replace('_', ' ')
297-
return re.sub(r'=\w{2}', _unquote_match, s, re.ASCII)
297+
return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII)

Lib/email/test/test_email.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,12 @@ def test_rfc2047_B_bad_padding(self):
16551655
dh = decode_header(s % q)
16561656
self.assertEqual(dh, [(a, 'iso-8859-1')])
16571657

1658+
def test_rfc2047_Q_invalid_digits(self):
1659+
# issue 10004.
1660+
s = '=?iso-8659-1?Q?andr=e9=zz?='
1661+
self.assertEqual(decode_header(s),
1662+
[(b'andr\xe9=zz', 'iso-8659-1')])
1663+
16581664

16591665
# Test the MIMEMessage class
16601666
class TestMIMEMessage(TestEmailBase):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ C-API
121121
Library
122122
-------
123123

124+
- Issue #10004: quoprimime no longer generates a traceback when confronted
125+
with invalid characters after '=' in a Q-encoded word.
126+
124127
- Issue #9950: Fix socket.sendall() crash or misbehaviour when a signal is
125128
received. Now sendall() properly calls signal handlers if necessary,
126129
and retries sending if these returned successfully, including on sockets

0 commit comments

Comments
 (0)