]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
In mapping from UCS4: don't crash for undefined mappings.
authorUlrich Drepper <drepper@redhat.com>
Tue, 28 Dec 1999 04:54:05 +0000 (04:54 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 28 Dec 1999 04:54:05 +0000 (04:54 +0000)
iconvdata/gbk.c

index 793034b02cc5e19cd34dc62d36e84169f09b9205..8e8d7b25f6b1bd500f5429e285d02ac2fd6b9359 100644 (file)
@@ -5549,7 +5549,7 @@ static const char __gbk_from_ucs4_tab1[][2] =
   [0x0044] = "\xa8\xa8", [0x0045] = "\xa8\xa6", [0x0046] = "\xa8\xba",
   [0x0048] = "\xa8\xac", [0x0049] = "\xa8\xaa", [0x004e] = "\xa8\xb0",
   [0x004f] = "\xa8\xae", [0x0053] = "\xa1\xc2", [0x0055] = "\xa8\xb4",
-  [0x0056] = "\xa8\xb2", [0x0058] = "\xa8\xb9",
+  [0x0056] = "\xa8\xb2", [0x0058] = "\xa8\xb9", [0x005d] = "\xa8\xa1"
 };
 
 /* The table can be created using
@@ -13190,12 +13190,9 @@ static const char __gbk_from_ucs4_tab12[][2] =
       {                                                                              \
       switch (ch)                                                            \
        {                                                                     \
-       case 0xa4 ... 0x100:                                                  \
+       case 0xa4 ... 0x101:                                                  \
          cp = __gbk_from_ucs4_tab1[ch - 0xa4];                               \
          break;                                                              \
-       case 0x101:                                                           \
-         cp = "\xa8\xa1";                                                    \
-         break;                                                              \
        case 0x113:                                                           \
          cp = "\xa8\xa5";                                                    \
          break;                                                              \
@@ -13455,7 +13452,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
          cp = "";                                                            \
          break;                                                              \
        }                                                                     \
-      if (cp[0] == '\0' && ch != 0)                                          \
+      if (cp == NULL || (cp[0] == '\0' && ch != 0))                          \
        {                                                                     \
          /* Illegal character.  */                                           \
          result = GCONV_ILLEGAL_INPUT;                                       \