From: Georg Brandl Date: Wed, 1 Oct 2014 17:15:11 +0000 (+0200) Subject: Fix unicode_aswidechar() for 4b unicode and 2b wchar_t (AIX). X-Git-Tag: v3.2.6rc1~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff3e5e3779ae6fab9f5d33149c95441eb847c196;p=python Fix unicode_aswidechar() for 4b unicode and 2b wchar_t (AIX). --- diff --git a/Misc/NEWS b/Misc/NEWS index 5b84414a3f..14d9630a8f 100644 --- 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 ------- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index cd4e9e9295..b7988509fb 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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;