[kaffe] kaffe.io.ByteToCharIconv may go in to an endless loop
Ito Kazumitsu
ito.kazumitsu at hitachi-cable.co.jp
Wed Nov 20 15:37:01 PST 2002
In message "Re: [kaffe] kaffe.io.ByteToCharIconv may go in to an endless loop"
on 02/11/20, Ito Kazumitsu <ito.kazumitsu at hitachi-cable.co.jp> writes:
> and found that in the abnormal cases "carry" is called endlessly.
Here is a patch to solve this problem.
--- libraries/clib/native/ByteToCharIconv.c.orig Tue Apr 16 04:14:50 2002
+++ libraries/clib/native/ByteToCharIconv.c Thu Nov 21 08:29:05 2002
@@ -89,6 +89,13 @@
icv_out = buffer;
#endif
ret = iconv (cd, &icv_in, &icv_inlen, &icv_out, &icv_outlen);
+ if (ret < 0) {
+ /* ignore an invalid multibyte sequence */
+ if (errno == EILSEQ) {
+ icv_in++;
+ icv_inlen--;
+ }
+ }
#ifndef WORDS_BIGENDIAN
swab (buffer, jc + toPos, toLen * 2 - icv_outlen);
KFREE (buffer);
More information about the kaffe
mailing list