Merged revisions 75404 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r75404 | antoine.pitrou | 2009-10-14 19:14:16 +0200 (mer., 14 oct. 2009) | 5 lines

  Issue #7065: Fix a crash in bytes.maketrans and bytearray.maketrans when
  using byte values greater than 127.  Patch by egreen.

........
This commit is contained in:
Antoine Pitrou 2009-10-14 17:18:54 +00:00
parent af4ea65a3a
commit 96bb15bcb4
3 changed files with 11 additions and 10 deletions

View file

@ -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: