Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 29 Aug 2000 21:14:05 +0000 (21:14 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 29 Aug 2000 21:14:05 +0000 (21:14 +0000)
2000-08-29  Akira Higuchi  <a@kondara.org>

* iconv/gconv_db.c (increment_counter): Reset __init_fct, __fct,
and __end_fct fields of struct __gconv_step.
* iconv/Makefile (tests): Add iconv-bug2.
* iconv/iconv-bug2.c: New file.

* iconvdata/euc-kr.c (BODY for FROM_LOOP): Pass 'inend - inptr'
instead of 'inptr - inend' to ksc5601_to_ucs4.

* iconvdata/sjis.c (BODY for FROM_LOOP): Allow 0x7f character.

* iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): If an incomplete
character or shift sequence is found at the end of the input
string, return__GCONV_INCOMPLETE_INPUT instead of
__GCONV_EMPTY_INPUT.
* iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise.
* iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise.

* iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Return
__GCONV_ILLEGAL_INPUT for 8bit characters.

13 files changed:
ChangeLog
iconv/gconv_db.c
iconvdata/Makefile
iconvdata/bug-iconv2.c [new file with mode: 0644]
iconvdata/euc-kr.c
iconvdata/iso-2022-cn.c
iconvdata/iso-2022-jp.c
iconvdata/iso-2022-kr.c
iconvdata/sjis.c
localedata/ChangeLog
localedata/SUPPORTED
localedata/charmaps/GB2312
localedata/charmaps/GBK

index 9caad1f..bef84db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2000-08-29  Akira Higuchi  <a@kondara.org>
+
+       * iconv/gconv_db.c (increment_counter): Reset __init_fct, __fct,
+       and __end_fct fields of struct __gconv_step.
+       * iconv/Makefile (tests): Add iconv-bug2.
+       * iconv/iconv-bug2.c: New file.
+
+       * iconvdata/euc-kr.c (BODY for FROM_LOOP): Pass 'inend - inptr'
+       instead of 'inptr - inend' to ksc5601_to_ucs4.
+
+       * iconvdata/sjis.c (BODY for FROM_LOOP): Allow 0x7f character.
+
+       * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): If an incomplete
+       character or shift sequence is found at the end of the input
+       string, return__GCONV_INCOMPLETE_INPUT instead of
+       __GCONV_EMPTY_INPUT.
+       * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise.
+       * iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise.
+
+       * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Return
+       __GCONV_ILLEGAL_INPUT for 8bit characters.
+
 2000-08-29  Ulrich Drepper  <drepper@redhat.com>
 
        * signal/signal.h (sigpause): Move __THROW before __asm__.
index 0caf310..50cedd6 100644 (file)
@@ -305,6 +305,15 @@ increment_counter (struct __gconv_step *steps, size_t nsteps)
            result = __GCONV_NOCONV;
            break;
          }
+
+       steps[cnt].__init_fct = steps[cnt].__shlib_handle->init_fct;
+       steps[cnt].__fct = steps[cnt].__shlib_handle->fct;
+       steps[cnt].__end_fct = steps[cnt].__shlib_handle->end_fct;
+
+       if (steps[cnt].__end_fct != NULL)
+         DL_CALL_FCT (steps[cnt].__end_fct, &steps[cnt]);
+       if (steps[cnt].__init_fct != NULL)
+         DL_CALL_FCT (steps[cnt].__init_fct, &steps[cnt]);
       }
   return result;
 }
index 195a81e..b309d75 100644 (file)
@@ -49,7 +49,7 @@ modules       := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5             \
 
 modules.so := $(addsuffix .so, $(modules))
 
-tests = bug-iconv1
+tests = bug-iconv1 bug-iconv2
 
 include ../Makeconfig
 
diff --git a/iconvdata/bug-iconv2.c b/iconvdata/bug-iconv2.c
new file mode 100644 (file)
index 0000000..a2bf44f
--- /dev/null
@@ -0,0 +1,47 @@
+/* Test case by Akira Higuchi <a@kondara.org>.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main (void)
+{
+  const char *dummy_codesets[] =
+  {
+    "ISO_8859-1", "ISO_8859-2", "ISO_8859-3", "ISO_8859-4",
+    "ISO_8859-5", "ISO_8859-6", "ISO_8859-7", "ISO_8859-8"
+  };
+  iconv_t dummy_cd[8], cd_a;
+  int i;
+  char buffer[1024], *to = buffer;
+  char *from = (char *) "foobar";
+  size_t to_left = 1024, from_left = 6;
+
+  /* load dummy modules */
+  for (i = 0; i < 8; i++)
+    if ((dummy_cd[i] = iconv_open (dummy_codesets[i], "UTF8")) == (iconv_t) -1)
+      exit (1);
+
+  /* load a module... */
+  if ((cd_a = iconv_open ("EUC-JP", "UTF8")) == (iconv_t) -1)
+    exit (1);
+  /* and close it once. we'll reload this later */
+  iconv_close (cd_a);
+
+  /* unload dummy modules */
+  for (i = 0; i < 8; i++)
+    iconv_close (dummy_cd[i]);
+
+  /* load the module again */
+  if ((cd_a = iconv_open ("EUC-JP", "UTF8")) == (iconv_t) -1)
+    exit (1);
+
+  puts ("This used to crash");
+  printf ("%d\n", iconv (cd_a, &from, &from_left, &to, &to_left));
+  iconv_close (cd_a);
+
+  puts ("works now");
+
+  return 0;
+}
index 7866958..9ea937c 100644 (file)
@@ -99,7 +99,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
       {                                                                              \
        /* Two-byte character.  First test whether the next character         \
           is also available.  */                                             \
-       ch = ksc5601_to_ucs4 (&inptr, inptr - inend, 0x80);                   \
+       ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80);                   \
        if (__builtin_expect (ch, 1) == 0)                                    \
          {                                                                   \
            /* The second character is not available.  */                     \
index 6ffa18d..d45ed6b 100644 (file)
@@ -151,7 +151,7 @@ enum
            || (inptr[1] == SS2_1                                             \
                && __builtin_expect (inptr + 3 > inend, 0)))                  \
          {                                                                   \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
        if (inptr[1] == '$'                                                   \
@@ -225,7 +225,7 @@ enum
                                                                              \
        if (__builtin_expect (ch, 1) == 0)                                    \
          {                                                                   \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
        else if (__builtin_expect (ch, 1) == __UNKNOWN_10646_CHAR)            \
index fc34aab..bd2e033 100644 (file)
@@ -258,7 +258,7 @@ gconv_end (struct __gconv_step *data)
                && __builtin_expect (inptr + 3 >= inend, 0)))                 \
          {                                                                   \
            /* Not enough input available.  */                                \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
                                                                              \
@@ -399,6 +399,18 @@ gconv_end (struct __gconv_step *data)
            continue;                                                         \
          }                                                                   \
       }                                                                              \
+    else if (ch >= 0x80)                                                     \
+      {                                                                              \
+       if (! ignore_errors_p ())                                             \
+         {                                                                   \
+           result = __GCONV_ILLEGAL_INPUT;                                   \
+           break;                                                            \
+         }                                                                   \
+                                                                             \
+       ++inptr;                                                              \
+       ++*irreversible;                                                      \
+       continue;                                                             \
+      }                                                                              \
     else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f))                  \
       /* Almost done, just advance the input pointer.  */                    \
       ++inptr;                                                               \
@@ -462,7 +474,7 @@ gconv_end (struct __gconv_step *data)
                                                                              \
        if (__builtin_expect (ch, 1) == 0)                                    \
          {                                                                   \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
        else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR)            \
index 56e17a2..c0280fc 100644 (file)
@@ -149,7 +149,7 @@ enum
                        && __builtin_expect (inptr + 3 > inend, 0)))))        \
                                                                              \
          {                                                                   \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
        if (inptr[1] == '$' && inptr[2] == ')' && inptr[3] == 'C')            \
@@ -188,7 +188,7 @@ enum
                                                                              \
        if (__builtin_expect (ch, 1) == 0)                                    \
          {                                                                   \
-           result = __GCONV_EMPTY_INPUT;                                     \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
        else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR)            \
index 244cec6..7bbfef3 100644 (file)
@@ -1941,7 +1941,7 @@ static const char from_ucs4_lat1[0xf8][2] =
   [0x0075] = "\x75\x00", [0x0076] = "\x76\x00", [0x0077] = "\x77\x00",
   [0x0078] = "\x78\x00", [0x0079] = "\x79\x00", [0x007a] = "\x7a\x00",
   [0x007b] = "\x7b\x00", [0x007c] = "\x7c\x00", [0x007d] = "\x7d\x00",
-  [0x007e] = "\x7e\x00",
+  [0x007e] = "\x7e\x00", [0x007f] = "\x7f\x00",
   [0x00a2] = "\x81\x91", [0x00a3] = "\x81\x92", [0x00a5] = "\x5c\x00",
   [0x00a7] = "\x81\x98", [0x00a8] = "\x81\x4e", [0x00ac] = "\x81\xca",
   [0x00b0] = "\x81\x8b", [0x00b1] = "\x81\x7d", [0x00b4] = "\x81\x4c",
@@ -4353,7 +4353,7 @@ static const char from_ucs4_extra[0x100][2] =
        ch = 0x203e;                                                          \
        ++inptr;                                                              \
       }                                                                              \
-    else if (ch < 0x7e)                                                              \
+    else if (ch < 0x80)                                                              \
       ++inptr;                                                               \
     else if (ch >= 0xa1 && ch <= 0xdf)                                       \
       {                                                                              \
index 559d001..4987943 100644 (file)
@@ -1,3 +1,10 @@
+2000-08-29  Akira Higuchi  <a@kondara.org>
+
+       * charmaps/GB2312: Fix ".." -> "..." in width definitions.
+       * charmaps/GBK: Likewise.
+
+       * SUPPORTED: Add zh_CN.GB2312 and zh_TW.BIG5.
+
 2000-08-27  Ulrich Drepper  <drepper@redhat.com>
 
        * locales/sv_SE: Remove old LC_COLLATE definition.  Use iso14651_t1
index 8522572..ae2a0d4 100644 (file)
@@ -127,3 +127,5 @@ th_TH TIS-620
 tr_TR ISO-8859-9
 uk_UA KOI8-U
 vi_VN UTF-8
+zh_CN GB2312
+zh_TW BIG5
index 3dd7b48..30d94ef 100644 (file)
@@ -7634,5 +7634,5 @@ CHARMAP
 END CHARMAP
 
 WIDTH
-<U3000>..<U9F44> 2
+<U3000>...<U9F44> 2
 END WIDTH
index 7c8b3bf..de48a44 100644 (file)
@@ -21929,5 +21929,5 @@ CHARMAP
 END CHARMAP
 
 WIDTH
-<U4E02>..<UFA29> 2
+<U4E02>...<UFA29> 2
 END WIDTH