mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
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:
parent
919765a095
commit
403ce78872
3 changed files with 11 additions and 10 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue