summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-02-05 17:36:00 +0000
committerWalter Dörwald <walter@livinglogic.de>2004-02-05 17:36:00 +0000
commitcd736e71a3d35d870c2ff89b90a39050553a2453 (patch)
tree7b166e3128b1ae6187a30f2405abe3220d14f265 /Objects/unicodeobject.c
parentbc875f5a36b744c1a7263c35befaf31208a416b1 (diff)
downloadcpython-git-cd736e71a3d35d870c2ff89b90a39050553a2453.tar.gz
Fix reallocation bug in unicode.translate(): The code was comparing
characters instead of character pointers to determine space requirements.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a218ddb6eb..e3bef57540 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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;