Skip to content

Commit fc6a1bc

Browse files
Issue #13461: Fix a crash in the TextIOWrapper.tell method and in the "replace"
error handler on 64-bit platforms. Patch by Yogesh Chaudhari.
1 parent 6ae24a4 commit fc6a1bc

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Jeffrey Chang
170170
Mitch Chapman
171171
Greg Chapman
172172
Brad Chapman
173+
Yogesh Chaudhari
173174
David Chaum
174175
Nicolas Chauvat
175176
Michael Chermside

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ What's New in Python 2.7.6?
99
Core and Builtins
1010
-----------------
1111

12+
- Issue #13461: Fix a crash in the "replace" error handler on 64-bit platforms.
13+
Patch by Yogesh Chaudhari.
14+
1215
- Issue #15866: The xmlcharrefreplace error handler no more produces two XML
1316
entities for a non-BMP character on narrow build.
1417

@@ -29,6 +32,9 @@ Core and Builtins
2932
Library
3033
-------
3134

35+
- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit
36+
platforms. Patch by Yogesh Chaudhari.
37+
3238
- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
3339
OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
3440

Modules/_io/textio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ textiowrapper_tell(textio *self, PyObject *args)
22712271
int dec_flags;
22722272

22732273
PyObject *decoded = PyObject_CallMethod(
2274-
self->decoder, "decode", "s#", input, 1);
2274+
self->decoder, "decode", "s#", input, (Py_ssize_t)1);
22752275
if (check_decoded(decoded) < 0)
22762276
goto fail;
22772277
chars_decoded += PyUnicode_GET_SIZE(decoded);

Python/codecs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
521521
Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER;
522522
if (PyUnicodeDecodeError_GetEnd(exc, &end))
523523
return NULL;
524-
return Py_BuildValue("(u#n)", &res, 1, end);
524+
return Py_BuildValue("(u#n)", &res, (Py_ssize_t)1, end);
525525
}
526526
else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) {
527527
PyObject *res;

0 commit comments

Comments
 (0)