]> granicus.if.org Git - python/commitdiff
Fix unicode_aswidechar() for 4b unicode and 2b wchar_t (AIX).
authorGeorg Brandl <georg@python.org>
Wed, 1 Oct 2014 17:15:11 +0000 (19:15 +0200)
committerGeorg Brandl <georg@python.org>
Wed, 1 Oct 2014 17:15:11 +0000 (19:15 +0200)
Misc/NEWS
Objects/unicodeobject.c

index 5b84414a3f9f96cb7fff8b7de4dde57c4562c880..14d9630a8fa8a475dbba34e5e7ed432d7906924b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -7,6 +7,12 @@ What's New in Python 3.2.6?
 
 *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
 -------
 
index cd4e9e9295c854e3792ea5f7e07233e51658d83d..b7988509fbe45452808b0a7939d519a8a8b586ce 100644 (file)
@@ -1267,7 +1267,7 @@ unicode_aswidechar(PyUnicodeObject *unicode,
     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;