diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-14 17:14:16 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-14 17:14:16 (GMT) |
commit | 403ce78872f6982b6ecaa96b94c88cbf0f1159e6 (patch) | |
tree | a817f003b83257955d7af4a8f12fe03782664890 /Objects | |
parent | 919765a0950ffa3cb81a70c7223c6252f45b4d7f (diff) | |
download | cpython-403ce78872f6982b6ecaa96b94c88cbf0f1159e6.zip cpython-403ce78872f6982b6ecaa96b94c88cbf0f1159e6.tar.gz cpython-403ce78872f6982b6ecaa96b94c88cbf0f1159e6.tar.bz2 |
Issue #7065: Fix a crash in bytes.maketrans and bytearray.maketrans when
using byte values greater than 127. Patch by egreen.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytes_methods.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 3bac2d1..6908eb8 100644 --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -427,7 +427,7 @@ _Py_bytes_maketrans(PyObject *args) { PyObject *frm, *to, *res = NULL; Py_buffer bfrm, bto; - int i; + Py_ssize_t i; char *p; bfrm.len = -1; @@ -452,7 +452,7 @@ _Py_bytes_maketrans(PyObject *args) for (i = 0; i < 256; i++) p[i] = i; for (i = 0; i < bfrm.len; i++) { - p[(int)((char *)bfrm.buf)[i]] = ((char *)bto.buf)[i]; + p[((unsigned char *)bfrm.buf)[i]] = ((char *)bto.buf)[i]; } done: |