aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-16 02:27:47 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-16 02:27:47 +0000
commitea31b613feba1c5f34ff2cf9f2c0bab3be4f8d2a (patch)
treedce127c44f40111c9076d20d840e662ccdc621ce /wcsmbs
parenta1a2fec161c0fafca0f8e5df454e9ec9fa15ed99 (diff)
downloadglibc-ea31b613feba1c5f34ff2cf9f2c0bab3be4f8d2a.tar
glibc-ea31b613feba1c5f34ff2cf9f2c0bab3be4f8d2a.tar.gz
glibc-ea31b613feba1c5f34ff2cf9f2c0bab3be4f8d2a.tar.bz2
glibc-ea31b613feba1c5f34ff2cf9f2c0bab3be4f8d2a.zip
Update.
* iconv/gconv_simple.c (STORE_REST): Explicitly store the total expected size into state. (UNPACK_BYTES): Do the reverse. * wcsmbs/tst-mbrtowc.c (utf8_test_1): Add test for the bug. Reported by Al Viro <aviro@redhat.com>.
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/tst-mbrtowc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/wcsmbs/tst-mbrtowc.c b/wcsmbs/tst-mbrtowc.c
index 4f1d1e586d..2400d8369f 100644
--- a/wcsmbs/tst-mbrtowc.c
+++ b/wcsmbs/tst-mbrtowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+/* We always want assert to be fully defined. */
+#undef NDEBUG
#include <assert.h>
#include <locale.h>
#include <stdio.h>
@@ -45,6 +47,20 @@ utf8_test_1 (void)
assert (mbrtowc (&wc, "", 1, &s) == 0); /* test final byte processing */
assert (wc == 0); /* test final byte decoding */
+ /* The following test is by Al Viro <aviro@redhat.com>. */
+ const char str[] = "\xe0\xa0\x80";
+
+ wc = 42; /* arbitrary number */
+ memset (&s, 0, sizeof (s)); /* get s into initial state */
+ assert (mbrtowc (&wc, str, 1, &s) == -2);
+ assert (mbrtowc (&wc, str + 1, 2, &s) == 2);
+ assert (wc == 0x800);
+
+ wc = 42; /* arbitrary number */
+ memset (&s, 0, sizeof (s)); /* get s into initial state */
+ assert (mbrtowc (&wc, str, 3, &s) == 3);
+ assert (wc == 0x800);
+
return 0;
}