Patch #1541585: fix buffer overrun when performing repr() on

a unicode string in a build with wide unicode (UCS-4) support.

This code could be improved, so add an XXX comment.
This commit is contained in:
Neal Norwitz 2006-08-21 22:21:19 +00:00
parent 0c6ae5bad4
commit 17753ecbfa
3 changed files with 34 additions and 12 deletions

View file

@ -92,6 +92,10 @@ class UnicodeTest(
"\\xfe\\xff'")
testrepr = repr(u''.join(map(unichr, xrange(256))))
self.assertEqual(testrepr, latin1repr)
# Test repr works on wide unicode escapes without overflow.
self.assertEqual(repr(u"\U00010000" * 39 + u"\uffff" * 4096),
repr(u"\U00010000" * 39 + u"\uffff" * 4096))
def test_count(self):
string_tests.CommonTest.test_count(self)