]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
iconv: Work around AIX 6.1..7.1 bug.
authorBruno Haible <bruno@clisp.org>
Sat, 31 Jul 2010 11:40:01 +0000 (13:40 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 30 Aug 2010 20:58:34 +0000 (22:58 +0200)
gettext-runtime/m4/ChangeLog
gettext-runtime/m4/iconv.m4

index 539355a35f952cc1dd8e56787211217994c3b813..982cdcb992b19aba23a6e8b575c431c14fbec41d 100644 (file)
@@ -1,3 +1,10 @@
+2010-07-31  Bruno Haible  <bruno@clisp.org>
+
+       iconv: Work around AIX 6.1..7.1 bug.
+       * iconv.m4 (AM_ICONV_LINK): Test against AIX 6.1, 7.1 bug. When
+       cross-compiling, guess no on all versions of AIX.
+       Reported by Rainer Tammer.
+
 2010-07-30  Bruno Haible  <bruno@clisp.org>
 
        iconv: Update regarding AIX.
index b78ba18af6689b9f1dd4f65c30414e63de245284..5e838b04b6c203c490a32a95b260b4e45a9d7c22 100644 (file)
@@ -1,4 +1,4 @@
-# iconv.m4 serial 13 (gettext-0.18.2)
+# iconv.m4 serial 14 (gettext-0.18.2)
 dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -66,7 +66,8 @@ AC_DEFUN([AM_ICONV_LINK],
   ])
   if test "$am_cv_func_iconv" = yes; then
     AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
-      dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
+      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+      dnl Solaris 10.
       am_save_LIBS="$LIBS"
       if test $am_cv_lib_iconv = yes; then
         LIBS="$LIBS $LIBICONV"
@@ -115,6 +116,24 @@ int main ()
           return 1;
       }
   }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          return 1;
+      }
+  }
 #if 0 /* This bug could be worked around by the caller.  */
   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
   {
@@ -153,8 +172,8 @@ int main ()
         [
 changequote(,)dnl
          case "$host_os" in
-           aix | aix[3-6]* | hpux*) am_cv_func_iconv_works="guessing no" ;;
-           *)                       am_cv_func_iconv_works="guessing yes" ;;
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
          esac
 changequote([,])dnl
         ])