]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Avoid crash on EUC-KR PO file.
authorBruno Haible <bruno@clisp.org>
Wed, 23 May 2001 19:42:49 +0000 (19:42 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 28 Jun 2009 14:35:50 +0000 (16:35 +0200)
lib/ChangeLog
lib/linebreak.c
src/ChangeLog
src/write-po.c

index d5cfefa6ed6780607aa3170a755862ed162ddaf5..03cb9a0cf38642edc7ae4062496e7a14535b2be9 100644 (file)
@@ -1,3 +1,9 @@
+2001-05-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * linebreak.c (mbs_possible_linebreaks): Avoid broken EUC-KR
+       conversion in glibc-2.1.
+       (mbs_width_linebreaks): Likewise.
+
 2001-05-02  Bruno Haible  <haible@clisp.cons.org>
 
        * linebreak.c (iconv_string_keeping_offsets): Work around a glibc-2.1
index 164f730fdbcf35c18efc2729c3ff8fc114252ab3..e3bacae29d38b78b251a394debf3ace9ca90175e 100644 (file)
@@ -1711,7 +1711,14 @@ mbs_possible_linebreaks (s, n, encoding, p)
   else
     {
 #if HAVE_ICONV
-      iconv_t to_utf8 = iconv_open (UTF8_NAME, encoding);
+      iconv_t to_utf8;
+      /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+      if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
+       to_utf8 = (iconv_t)(-1);
+      else
+# endif
+      to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
         {
           /* Determine the length of the resulting UTF-8 string.  */
@@ -1790,7 +1797,14 @@ mbs_width_linebreaks (s, n, width, start_column, at_end_columns, o, encoding, p)
   else
     {
 #if HAVE_ICONV
-      iconv_t to_utf8 = iconv_open (UTF8_NAME, encoding);
+      iconv_t to_utf8;
+      /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+      if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
+       to_utf8 = (iconv_t)(-1);
+      else
+# endif
+      to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
         {
           /* Determine the length of the resulting UTF-8 string.  */
index 36abf66ecbb6a633a798d527cb5d0664e7dfe0a5..5556d532c385ccf217bb019523041d1178efdd23 100644 (file)
@@ -1,3 +1,7 @@
+2001-05-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * write-po.c (wrap): Avoid broken EUC-KR conversion in glibc-2.1.
+
 2001-05-21  Bruno Haible  <haible@clisp.cons.org>
 
        * xgettext.c (construct_header): Replace 8-bit with 8bit.
index 48eeb67c4a08778b03eb38df770a853a1d1186f6..64fecf4197172671833c4eb4d56625f70943ac28 100644 (file)
@@ -211,6 +211,12 @@ wrap (fp, line_prefix, name, value, do_wrap, charset)
     /* Write a PO file in old format, with extraneous backslashes.  */
     conv = (iconv_t)(-1);
   else
+    /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+    if (strcmp (charset, "EUC-KR") == 0)
+      conv = (iconv_t)(-1);
+    else
+# endif
     /* Use iconv() to parse multibyte characters.  */
     conv = iconv_open ("UTF-8", charset);
 #endif