From: Martin v. Löwis Date: Mon, 5 Jun 2006 10:43:57 +0000 (+0000) Subject: Don't crash on Py_UNICODE values < 0. Fixes #1454485. X-Git-Tag: v2.4.4c1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbbe647bb78886d841d4dc0b7827e29b059b3451;p=thirdparty%2FPython%2Fcpython.git Don't crash on Py_UNICODE values < 0. Fixes #1454485. --- diff --git a/Misc/NEWS b/Misc/NEWS index 3171e036593f..cac884c98dad 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's New in Python 2.4.4c1? Core and builtins ----------------- +- Bug #1454485: Don't crash on Unicode characters <0. + - Patch #1488312, Fix memory alignment problem on SPARC in unicode Extension Modules diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 5fce3f91c729..7c69d68a9d33 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -319,7 +319,9 @@ PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u, /* Single character Unicode objects in the Latin-1 range are shared when using this constructor */ - if (size == 1 && *u < 256) { + /* XXX In Python 2.4, Py_UNICODE can, unfortunately, be a signed + type. */ + if (size == 1 && *u >= 0 && *u < 256) { unicode = unicode_latin1[*u]; if (!unicode) { unicode = _PyUnicode_New(1);