summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-08 00:04:24 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-08 00:04:24 +0000
commitf2a8406a4f5974230d33995105160a8bacbce500 (patch)
treeae84626e8353895088f0457362dcf446fbc68557
parent9ca230d62f1813679700f821d3de48ce4aa73f2a (diff)
downloadglibc-f2a8406a4f5974230d33995105160a8bacbce500.tar.gz
glibc-f2a8406a4f5974230d33995105160a8bacbce500.tar.xz
glibc-f2a8406a4f5974230d33995105160a8bacbce500.zip
[BZ #5277]
2007-11-07  Ulrich Drepper  <drepper@redhat.com>
	[BZ #5277]
	* iconv/loop.c (STANDARD_TO_LOOP_ERR_HANDLER): If conversion failed
	because output buffer is too small break, don't loop.
	* iconvdata/Makefile (tests): Add bug-iconv6.
	* iconvdata/bug-iconv6.c: New file.
-rw-r--r--ChangeLog8
-rw-r--r--iconv/loop.c7
-rw-r--r--iconvdata/Makefile2
-rw-r--r--iconvdata/bug-iconv6.c52
-rw-r--r--localedata/ChangeLog5
-rw-r--r--localedata/locales/lo_LA8
6 files changed, 76 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ec0b863f8..17178716f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-11-07  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #5277]
+	* iconv/loop.c (STANDARD_TO_LOOP_ERR_HANDLER): If conversion failed
+	because output buffer is too small break, don't loop.
+	* iconvdata/Makefile (tests): Add bug-iconv6.
+	* iconvdata/bug-iconv6.c: New file.
+
 2007-11-06  Ulrich Drepper  <drepper@redhat.com>
 
 	* stdio-common/vfprintf.c (vfprintf): Compute necessary buffer size
diff --git a/iconv/loop.c b/iconv/loop.c
index 9785bf865c..df8c8dce9f 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -225,7 +225,12 @@
       }									      \
     /* If any of them recognized the input continue with the loop.  */	      \
     if (result != __GCONV_ILLEGAL_INPUT)				      \
-      continue;								      \
+      {									      \
+	if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0))	      \
+	  break;							      \
+									      \
+	continue;							      \
+      }									      \
 									      \
     /* Next see whether we have to ignore the error.  If not, stop.  */	      \
     if (! ignore_errors_p ())						      \
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index bf52d52f8f..ca4c713179 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -67,7 +67,7 @@ include ../Makeconfig
 
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-	tst-iconv6 bug-iconv5
+	tst-iconv6 bug-iconv5 bug-iconv6
 ifeq ($(have-thread-library),yes)
 tests += bug-iconv3
 endif
diff --git a/iconvdata/bug-iconv6.c b/iconvdata/bug-iconv6.c
new file mode 100644
index 0000000000..f920954bc2
--- /dev/null
+++ b/iconvdata/bug-iconv6.c
@@ -0,0 +1,52 @@
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <iconv.h>
+#include <locale.h>
+
+static const char testbuf[] = {
+	0xEF, 0xBE, 0x9F, 0xD0, 0xB4, 0xEF, 0xBE, 0x9F, 0x29, 0xEF, 0xBE, 0x8E,
+	0xEF, 0xBE, 0x9F, 0xEF, 0xBD, 0xB6, 0xEF, 0xBD, 0xB0, 0xEF, 0xBE, 0x9D
+};
+
+static int
+do_test (void)
+{
+  setlocale (LC_ALL, "en_US.UTF-8");
+  iconv_t ic = iconv_open ("ISO-2022-JP//TRANSLIT", "UTF-8");
+  if (ic == (iconv_t) -1)
+    {
+      puts ("iconv_open failed");
+      return 1;
+    }
+  size_t outremain = sizeof testbuf;
+  char outbuf[outremain];
+  char *inp = (char *) testbuf;
+  char *outp = outbuf;
+  size_t inremain = sizeof testbuf;
+
+  int ret = iconv (ic, &inp, &inremain, &outp, &outremain);
+
+  int result = 0;
+  if (ret == (size_t) -1)
+    {
+      if (errno == E2BIG)
+	puts ("buffer too small reported.  OK");
+      else
+	{
+	  printf ("iconv failed with %d (%m)\n", errno);
+	  result = 0;
+	}
+    }
+  else
+    {
+      printf ("iconv returned %d\n", ret);
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 507a679c96..f7c6c08dc3 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-07  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #5237]
+	* locales/lo_LA: Fix typos in collation symbols.
+
 2007-11-06  Ulrich Drepper  <drepper@redhat.com>
 
 	* locales/dz_BT: Fix representation of data.
diff --git a/localedata/locales/lo_LA b/localedata/locales/lo_LA
index cc764e1678..29ab3f322b 100644
--- a/localedata/locales/lo_LA
+++ b/localedata/locales/lo_LA
@@ -602,10 +602,10 @@ UNDEFINED      IGNORE;IGNORE;IGNORE;IGNORE
 
 <U0EDD>        <U0EDC>;<BLANK>;<BLANK>;<BLANK> % Lao CHARACTER HHOr
 <mhor-e>           "<U0EDD><U0EC0>";<BLANK>;<BLANK>;<BLANK>
-<mor-ae>           "<U0EDD><U0EC1>";<BLANK>;<BLANK>;<BLANK>
-<mor-o>            "<U0EDD><U0EC2>";<BLANK>;<BLANK>;<BLANK>
-<mor-ai-maimuan>   "<U0EDD><U0EC3>";<BLANK>;<BLANK>;<BLANK>
-<mor-ai-maimalai>  "<U0EDD><U0EC4>";<BLANK>;<BLANK>;<BLANK>
+<mhor-ae>          "<U0EDD><U0EC1>";<BLANK>;<BLANK>;<BLANK>
+<mhor-o>           "<U0EDD><U0EC2>";<BLANK>;<BLANK>;<BLANK>
+<mhor-ai-maimuan>  "<U0EDD><U0EC3>";<BLANK>;<BLANK>;<BLANK>
+<mhor-ai-maimalai> "<U0EDD><U0EC4>";<BLANK>;<BLANK>;<BLANK>
 
 
 % order of Lao vowels