mirror of
https://github.com/python/cpython.git
synced 2025-08-19 16:20:59 +00:00
#2242: utf7 decoding crashes on bogus input on some Windows/MSVC versions
This commit is contained in:
parent
ab396e07cc
commit
c8e4bed1c5
3 changed files with 20 additions and 14 deletions
|
@ -532,6 +532,9 @@ class UnicodeTest(
|
|||
|
||||
self.assertEqual(unicode('+3ADYAA-', 'utf-7', 'replace'), u'\ufffd')
|
||||
|
||||
# Issue #2242: crash on some Windows/MSVC versions
|
||||
self.assertRaises(UnicodeDecodeError, '+\xc1'.decode, 'utf-7')
|
||||
|
||||
def test_codecs_utf8(self):
|
||||
self.assertEqual(u''.encode('utf-8'), '')
|
||||
self.assertEqual(u'\u20ac'.encode('utf-8'), '\xe2\x82\xac')
|
||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.5.3?
|
|||
Core and builtins
|
||||
-----------------
|
||||
|
||||
- Issue #2242: Fix a crash when decoding invalid utf-7 input on certain
|
||||
Windows / Visual Studio versions.
|
||||
|
||||
- Issue #3360: Fix incorrect parsing of '020000000000.0', which
|
||||
produced a ValueError instead of giving the correct float.
|
||||
|
||||
|
|
|
@ -974,7 +974,7 @@ PyObject *PyUnicode_DecodeUTF7(const char *s,
|
|||
while (s < e) {
|
||||
Py_UNICODE ch;
|
||||
restart:
|
||||
ch = *s;
|
||||
ch = (unsigned char) *s;
|
||||
|
||||
if (inShift) {
|
||||
if ((ch == '-') || !B64CHAR(ch)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue