[Python-checkins] cpython (3.2): Fix unicode_aswidechar() for 4b unicode and 2b wchar_t (AIX).

georg.brandl python-checkins at python.org
Wed Oct 1 19:18:13 CEST 2014


https://hg.python.org/cpython/rev/18983332626b
changeset:   92714:18983332626b
branch:      3.2
parent:      92677:f9cd915410d2
user:        Georg Brandl <georg at python.org>
date:        Wed Oct 01 19:15:11 2014 +0200
summary:
  Fix unicode_aswidechar() for 4b unicode and 2b wchar_t (AIX).

files:
  Misc/NEWS               |  6 ++++++
  Objects/unicodeobject.c |  2 +-
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -7,6 +7,12 @@
 
 *Release date: TBD*
 
+Core and Builtins
+-----------------
+
+- Issue #19529: Fix a potential crash in converting Unicode objects to wchar_t
+  when Py_UNICODE is 4 bytes but wchar_t is 2 bytes, for example on AIX.
+
 Library
 -------
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1267,7 +1267,7 @@
     Py_ssize_t nchar;
 
     u = PyUnicode_AS_UNICODE(unicode);
-    uend = u + PyUnicode_GET_SIZE(u);
+    uend = u + PyUnicode_GET_SIZE(unicode);
     if (w != NULL) {
         worig = w;
         wend = w + size;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list