In message "Re: [kaffe] kaffe.io.ByteToCharIconv may go in to an endless loop"
    on 02/11/20, Ito Kazumitsu <[EMAIL PROTECTED]> 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);

_______________________________________________
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to