[kaffe] kaffe.io.ByteToCharIconv may go in to an endless loop

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Wed Nov 20 03:41:57 PST 2002


In message "[kaffe] kaffe.io.ByteToCharIconv may go in to an endless loop"
    on 02/11/19, Ito Kazumitsu <ito.kazumitsu at hitachi-cable.co.jp> writes:

> The attached program never stops when run under certain conditions.
> The common thing among such abnormal cases is that kaffe.io.ByteToCharIconv
> must be used to convert the bytes into characters.

I run the test program after applying the following patch:

--- kaffe/io/ByteToCharConverter.java.orig	Wed Nov  6 13:38:19 2002
+++ kaffe/io/ByteToCharConverter.java	Wed Nov 20 19:53:14 2002
@@ -48,6 +48,9 @@
 }
 
 void carry ( byte[] from, int fpos, int flen ) {
+        System.err.println("ByteToCharConverter: carry " + fpos + " " + flen);
+        System.err.flush();
+
 	int n;
 	int m = blen + flen;
 

and found that in the abnormal cases "carry" is called endlessly.
 
$ java Test test1-EUC EUC_JP
ByteToCharConverter: carry 127 1
ByteToCharConverter: carry 127 1
...
ByteToCharConverter: carry 58 1
OK
$ java Test test1-UTF8 UTF8
ByteToCharConverter: carry 126 2
ByteToCharConverter: carry 126 2
...
ByteToCharConverter: carry 7 2
OK
$ java Test test1-SJIS SHIFT_JIS
ByteToCharConverter: carry 14 114
ByteToCharConverter: carry 0 128
...
ByteToCharConverter: carry 0 128
ByteToCharConverter: carry 0 128
ByteToCharConverter: carry 0 128
^C
$ java Test test1-ISO-2022-JP ISO-2022-JP
ByteToCharConverter: carry 23 105
ByteToCharConverter: carry 0 128
...
ByteToCharConverter: carry 0 128
ByteToCharConverter: carry 0 128
ByteToCharConverter: carry 0 128
^C




More information about the kaffe mailing list