[kaffe] CharToByteIconv dumps core when used for SHIFT_JIS
Ito Kazumitsu
ito.kazumitsu@hitachi-cable.co.jp
Mon Apr 28 00:46:01 2003
I found a case where CharToByteIconv dumps core when used for SHIFT_JIS.
Test Program
============
public class IconvSHIFT_JIS {
public static void main(String[] args) throws Exception {
"".getBytes("SHIFT_JIS");
}
}
A patch to CharToByteIconv.c
============================
--- libraries/clib/native/CharToByteIconv.c.orig Tue Apr 16 04:14:50 2002
+++ libraries/clib/native/CharToByteIconv.c Mon Apr 28 16:24:27 2003
@@ -76,6 +76,8 @@
char *buffer;
#endif
+ if (icv_inlen == 0) return 0;
+
#ifndef WORDS_BIGENDIAN
buffer = KMALLOC (icv_inlen);
if (!buffer) {