[Python-checkins] r46669 - in python/branches/release24-maint: Misc/NEWS Objects/unicodeobject.c

martin.v.loewis python-checkins at python.org
Mon Jun 5 12:44:37 CEST 2006


Author: martin.v.loewis
Date: Mon Jun  5 12:43:57 2006
New Revision: 46669

Modified:
   python/branches/release24-maint/Misc/NEWS
   python/branches/release24-maint/Objects/unicodeobject.c
Log:
Don't crash on Py_UNICODE values < 0. Fixes #1454485.


Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Mon Jun  5 12:43:57 2006
@@ -12,6 +12,8 @@
 Core and builtins
 -----------------
 
+- Bug #1454485: Don't crash on Unicode characters <0.
+
 - Patch #1488312, Fix memory alignment problem on SPARC in unicode
 
 Extension Modules

Modified: python/branches/release24-maint/Objects/unicodeobject.c
==============================================================================
--- python/branches/release24-maint/Objects/unicodeobject.c	(original)
+++ python/branches/release24-maint/Objects/unicodeobject.c	Mon Jun  5 12:43:57 2006
@@ -319,7 +319,9 @@
 
 	/* 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);


More information about the Python-checkins mailing list