about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorRichard Sandiford <richard@codesourcery.com>2013-10-18 20:58:31 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-10-18 20:58:31 +0000
commit5abe0682337db0aa15e2adf027d10e5b75b31c5a (patch)
treec2851d5985a8401d4e134d8a173e717f706ca25e /locale
parentc7738d0822fd34e95ebf01ce8fa8ea397bc4843d (diff)
downloadglibc-5abe0682337db0aa15e2adf027d10e5b75b31c5a.tar.gz
glibc-5abe0682337db0aa15e2adf027d10e5b75b31c5a.tar.xz
glibc-5abe0682337db0aa15e2adf027d10e5b75b31c5a.zip
Fix localedef collation handling of <U0000> (bug 15948).
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/ld-collate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index d88a6de56e..f7ae09792a 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -352,6 +352,9 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
     {
       size_t nwcs = wcslen ((wchar_t *) wcs);
       uint32_t zero = 0;
+      /* Handle <U0000> as a single character.  */
+      if (nwcs == 0)
+	nwcs = 1;
       obstack_grow (&collate->mempool, wcs, nwcs * sizeof (uint32_t));
       obstack_grow (&collate->mempool, &zero, sizeof (uint32_t));
       newp->wcs = (uint32_t *) obstack_finish (&collate->mempool);
@@ -2078,6 +2081,7 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
 	      weightidx = output_weightwc (atwc.weightpool, atwc.collate,
 					   runp);
 
+	      assert (runp->nwcs > 0);
 	      added = (1 + 1 + runp->nwcs - 1) * sizeof (int32_t);
 	      if (sizeof (int) == sizeof (int32_t))
 		obstack_make_room (atwc.extrapool, added);