antoine.pitrou
2008-07-25 18:05:26 UTC
Author: antoine.pitrou
Date: Fri Jul 25 20:05:24 2008
New Revision: 65230
Log:
Merged revisions 65227 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r65227 | antoine.pitrou | 2008-07-25 19:45:59 +0200 (ven., 25 juil. 2008) | 3 lines
#2242: utf7 decoding crashes on bogus input on some Windows/MSVC versions
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_unicode.py
python/branches/py3k/Objects/unicodeobject.c
Modified: python/branches/py3k/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unicode.py (original)
+++ python/branches/py3k/Lib/test/test_unicode.py Fri Jul 25 20:05:24 2008
@@ -847,6 +847,9 @@
self.assertEqual(str(b'+3ADYAA-', 'utf-7', 'replace'), '\ufffd')
+ # Issue #2242: crash on some Windows/MSVC versions
+ self.assertRaises(UnicodeDecodeError, b'+\xc1'.decode, 'utf-7')
+
def test_codecs_utf8(self):
self.assertEqual(''.encode('utf-8'), b'')
self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac')
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c (original)
+++ python/branches/py3k/Objects/unicodeobject.c Fri Jul 25 20:05:24 2008
@@ -1727,7 +1727,7 @@
while (s < e) {
Py_UNICODE ch;
restart:
- ch = *s;
+ ch = (unsigned char) *s;
if (inShift) {
if ((ch == '-') || !B64CHAR(ch)) {
Date: Fri Jul 25 20:05:24 2008
New Revision: 65230
Log:
Merged revisions 65227 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r65227 | antoine.pitrou | 2008-07-25 19:45:59 +0200 (ven., 25 juil. 2008) | 3 lines
#2242: utf7 decoding crashes on bogus input on some Windows/MSVC versions
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_unicode.py
python/branches/py3k/Objects/unicodeobject.c
Modified: python/branches/py3k/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unicode.py (original)
+++ python/branches/py3k/Lib/test/test_unicode.py Fri Jul 25 20:05:24 2008
@@ -847,6 +847,9 @@
self.assertEqual(str(b'+3ADYAA-', 'utf-7', 'replace'), '\ufffd')
+ # Issue #2242: crash on some Windows/MSVC versions
+ self.assertRaises(UnicodeDecodeError, b'+\xc1'.decode, 'utf-7')
+
def test_codecs_utf8(self):
self.assertEqual(''.encode('utf-8'), b'')
self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac')
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c (original)
+++ python/branches/py3k/Objects/unicodeobject.c Fri Jul 25 20:05:24 2008
@@ -1727,7 +1727,7 @@
while (s < e) {
Py_UNICODE ch;
restart:
- ch = *s;
+ ch = (unsigned char) *s;
if (inShift) {
if ((ch == '-') || !B64CHAR(ch)) {