From 653d00640e6ddde767bd9e97967ebe6df32d1a4d Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 13 Jun 2008 05:03:31 +0000 Subject: [PATCH] Fix crash with multibyte characters in large strings. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26638 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/Additions/Unicode.m | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66b8c785f..7acc2484f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-13 Richard Frith-Macdonald + + * Source/Additions/Unicode.m: Fix incorrect adjustment of buffer + when handling large string containing multibyte utf-8 data. + 2008-06-12 Richard Frith-Macdonald * Update timezones, bump version to 1.17.0 for next release. diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m index 6ffe703dd..d7ab6d89e 100644 --- a/Source/Additions/Unicode.m +++ b/Source/Additions/Unicode.m @@ -720,17 +720,16 @@ if (dst == 0) \ { \ /* \ * Data is just being discarded anyway, so we can \ - * adjust the offset into the local buffer on the \ + * reset the offset into the local buffer on the \ * stack and pretend the buffer has grown. \ */ \ + ptr = buf; \ if (extra == 0) \ { \ - ptr -= BUFSIZ; \ bsize += BUFSIZ; \ } \ else \ { \ - ptr -= BUFSIZ-1; \ bsize += BUFSIZ-1; \ } \ } \ @@ -1245,17 +1244,16 @@ if (dst == 0) \ { \ /* \ * Data is just being discarded anyway, so we can \ - * adjust the offset into the local buffer on the \ + * reset the offset into the local buffer on the \ * stack and pretend the buffer has grown. \ */ \ + ptr = buf; \ if (extra == 0) \ { \ - ptr -= BUFSIZ; \ bsize += BUFSIZ; \ } \ else \ { \ - ptr -= BUFSIZ-1; \ bsize += BUFSIZ-1; \ } \ } \