]> granicus.if.org Git - python/commitdiff
Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 20 Aug 2013 17:08:53 +0000 (20:08 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 20 Aug 2013 17:08:53 +0000 (20:08 +0300)
error handler on 64-bit platforms.  Patch by Yogesh Chaudhari.

Misc/ACKS
Misc/NEWS
Modules/_io/textio.c
Python/codecs.c

index 52019a827aa9114a075ed499fc40579d4ffd4729..8aba36e300505f6b3c6712f33d0e89cdf10d0adc 100644 (file)
--- 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
index 0f4b701e208097ca5ef1366b9d3b2a0039929d83..9ee4cfe267009293017dddc3d1f8b22d9e81d793 100644 (file)
--- 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.
 
index cd6d443e23fa71f4ec16f20936c283503d7ef7a4..680275876e5b2715204b114b97730692cf84c419 100644 (file)
@@ -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);
index 91147a07a32405aa9b62349b5fcd5a74ee6992a6..69498c4b0c95de03e5b15f411febde26fa1d0d94 100644 (file)
@@ -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;