mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fix reallocation bug in unicode.translate(): The code was comparing
characters instead of character pointers to determine space requirements.
This commit is contained in:
parent
bc875f5a36
commit
cd736e71a3
2 changed files with 2 additions and 1 deletions
|
@ -3283,7 +3283,7 @@ int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp
|
|||
else if (repsize!=0) {
|
||||
/* more than one character */
|
||||
int requiredsize = (*outp-PyUnicode_AS_UNICODE(*outobj)) +
|
||||
(insize - (*curinp-*startinp)) +
|
||||
(insize - (curinp-startinp)) +
|
||||
repsize - 1;
|
||||
if (charmaptranslate_makespace(outobj, outp, requiredsize))
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue