From: Serhiy Storchaka Date: Tue, 20 Aug 2013 17:08:53 +0000 (+0300) Subject: Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace" X-Git-Tag: v2.7.6rc1~216 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9885e93eeecf799893dcfed59146f98859031f1;p=thirdparty%2FPython%2Fcpython.git Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace" error handler on 64-bit platforms. Patch by Yogesh Chaudhari. --- diff --git a/Misc/ACKS b/Misc/ACKS index 52019a827aa9..8aba36e30050 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -170,6 +170,7 @@ Jeffrey Chang Mitch Chapman Greg Chapman Brad Chapman +Yogesh Chaudhari David Chaum Nicolas Chauvat Michael Chermside diff --git a/Misc/NEWS b/Misc/NEWS index 0f4b701e2080..9ee4cfe26700 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ What's New in Python 2.7.6? Core and Builtins ----------------- +- Issue #13461: Fix a crash in the "replace" error handler on 64-bit platforms. + Patch by Yogesh Chaudhari. + - Issue #15866: The xmlcharrefreplace error handler no more produces two XML entities for a non-BMP character on narrow build. @@ -29,6 +32,9 @@ Core and Builtins Library ------- +- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit + platforms. Patch by Yogesh Chaudhari. + - Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index cd6d443e23fa..680275876e5b 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2271,7 +2271,7 @@ textiowrapper_tell(textio *self, PyObject *args) int dec_flags; PyObject *decoded = PyObject_CallMethod( - self->decoder, "decode", "s#", input, 1); + self->decoder, "decode", "s#", input, (Py_ssize_t)1); if (check_decoded(decoded) < 0) goto fail; chars_decoded += PyUnicode_GET_SIZE(decoded); diff --git a/Python/codecs.c b/Python/codecs.c index 91147a07a324..69498c4b0c95 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -521,7 +521,7 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc) Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER; if (PyUnicodeDecodeError_GetEnd(exc, &end)) return NULL; - return Py_BuildValue("(u#n)", &res, 1, end); + return Py_BuildValue("(u#n)", &res, (Py_ssize_t)1, end); } else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) { PyObject *res;