aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-09-26 08:39:30 +0000
committerJakub Jelinek <jakub@redhat.com>2004-09-26 08:39:30 +0000
commit959f4c054789f1ce232bea8d226859262ed1bcbb (patch)
treed6820d5f43c214aafec8e5bf0de3ec6011ee923d
parent627cc92643ed34eecd0ac771d8b04df25270aaae (diff)
downloadglibc-959f4c054789f1ce232bea8d226859262ed1bcbb.tar
glibc-959f4c054789f1ce232bea8d226859262ed1bcbb.tar.gz
glibc-959f4c054789f1ce232bea8d226859262ed1bcbb.tar.bz2
glibc-959f4c054789f1ce232bea8d226859262ed1bcbb.zip
Updated to fedora-glibc-20040926T0823
-rw-r--r--ChangeLog11
-rw-r--r--fedora/branch.mk4
-rw-r--r--intl/l10nflist.c1
-rw-r--r--intl/loadinfo.h3
-rw-r--r--intl/loadmsgcat.c8
-rw-r--r--libio/vasprintf.c8
-rw-r--r--locale/loadlocale.c38
7 files changed, 54 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index dcbab5ec5c..b92394eb40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,18 @@
2004-09-25 Ulrich Drepper <drepper@redhat.com>
+ * locale/loadlocale.c (_nl_intern_locale_data): Recognize LC_CTYPE
+ data where _nl_value_type_LC_CTYPE does not contain the type
+ information. Add range checks.
+ Reported by John Lumby <johnlumby@hotmail.com> [BZ #356].
+
+ * libio/vasprintf.c (_IO_vasprintf): Fix condition to decide
+ whether to realloc or not.
+ Reported by Pavel Kankovsky <peak@argo.troja.mff.cuni.cz> [BZ #346].
+
* intl/dcigettext.c (DCIGETTEXT): Protect tfind/tsearch calls.
* intl/dcigettext.c (_nl_find_msg): Call _nl_load_domain also if
decided < 0.
* intl/finddomain.c (_nl_find_domain): Likewise.
- * intl/l10nflist.c (_nl_make_l10nflist): Initialize lock.
- * intl/loadinfo.h (struct loaded_l10nfile): Add lock element.
* intl/loadmsgcat.c (_nl_load_domain): Set decided to 1 only once we
are done. First set to -1 to signal initialization is ongoing.
Protect against concurrent callers with recursive lock.
diff --git a/fedora/branch.mk b/fedora/branch.mk
index e7c3bf9511..46ec6e506d 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
# This file is updated automatically by Makefile.
glibc-branch := fedora
glibc-base := HEAD
-fedora-sync-date := 2004-09-25 07:38 UTC
-fedora-sync-tag := fedora-glibc-20040925T0738
+fedora-sync-date := 2004-09-26 08:23 UTC
+fedora-sync-tag := fedora-glibc-20040926T0823
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 5a366e59fb..7ffb4ab590 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -280,7 +280,6 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
- __libc_lock_init_recursive (retval->lock);
if (last == NULL)
{
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
index 913022eb7b..2c1b44cec4 100644
--- a/intl/loadinfo.h
+++ b/intl/loadinfo.h
@@ -20,8 +20,6 @@
#ifndef _LOADINFO_H
#define _LOADINFO_H 1
-#include <bits/libc-lock.h>
-
/* Declarations of locale dependent catalog lookup functions.
Implemented in
@@ -63,7 +61,6 @@ struct loaded_l10nfile
{
const char *filename;
int decided;
- __libc_lock_define_recursive (, lock);
const void *data;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index ec886d9bd7..efefc69a43 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -88,6 +88,7 @@ char *alloca ();
#ifdef _LIBC
# include "../locale/localeinfo.h"
# include <not-cancel.h>
+# include <bits/libc-lock.h>
#endif
/* Provide fallback values for macros that ought to be defined in <inttypes.h>.
@@ -899,6 +900,7 @@ _nl_load_domain (domain_file, domainbinding)
struct loaded_l10nfile *domain_file;
struct binding *domainbinding;
{
+ __libc_lock_define_initialized_recursive (static, lock);
int fd = -1;
size_t size;
#ifdef _LIBC
@@ -912,7 +914,7 @@ _nl_load_domain (domain_file, domainbinding)
int revision;
const char *nullentry;
- __libc_lock_lock_recursive (domain_file->lock);
+ __libc_lock_lock_recursive (lock);
if (domain_file->decided != 0)
{
/* There are two possibilities:
@@ -925,7 +927,7 @@ _nl_load_domain (domain_file, domainbinding)
Not necessary anymore since if the lock is available this
is finished.
*/
- __libc_lock_unlock_recursive (domain_file->lock);
+ __libc_lock_unlock_recursive (lock);
return;
}
@@ -1400,7 +1402,7 @@ _nl_load_domain (domain_file, domainbinding)
domain_file->decided = 1;
- __libc_lock_unlock_recursive (domain_file->lock);
+ __libc_lock_unlock_recursive (lock);
}
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index 4e5b7f4cac..e32a488438 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999-2002,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -64,11 +64,11 @@ _IO_vasprintf (result_ptr, format, args)
free (sf._sbf._f._IO_buf_base);
return ret;
}
- /* Only use realloc if the size we need is of the same order of
- magnitude then the memory we allocated. */
+ /* Only use realloc if the size we need is of the same (binary)
+ order of magnitude then the memory we allocated. */
needed = sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base + 1;
allocated = sf._sbf._f._IO_write_end - sf._sbf._f._IO_write_base;
- if ((allocated << 1) <= needed)
+ if ((allocated >> 1) <= needed)
*result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, needed);
else
{
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index b2d944794f..11ece50a22 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -1,5 +1,5 @@
/* Functions to read locale data files.
- Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -115,15 +115,45 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
__set_errno (EINVAL);
return NULL;
}
- if (__builtin_expect (_nl_value_types[category][cnt] == word, 0))
+
+ /* Determine the type. There is one special case: the LC_CTYPE
+ category can have more elements than there are in the
+ _nl_value_type_LC_XYZ array. There are all pointers. */
+ switch (category)
+ {
+#define CATTEST(cat) \
+ case LC_##cat: \
+ assert (cnt < (sizeof (_nl_value_type_LC_##cat) \
+ / sizeof (_nl_value_type_LC_##cat[0]))); \
+ break
+ CATTEST (NUMERIC);
+ CATTEST (TIME);
+ CATTEST (COLLATE);
+ CATTEST (MONETARY);
+ CATTEST (MESSAGES);
+ CATTEST (PAPER);
+ CATTEST (NAME);
+ CATTEST (ADDRESS);
+ CATTEST (TELEPHONE);
+ CATTEST (MEASUREMENT);
+ CATTEST (IDENTIFICATION);
+ default:
+ assert (category == LC_CTYPE);
+ break;
+ }
+
+ if ((category == LC_CTYPE
+ && cnt >= (sizeof (_nl_value_type_LC_CTYPE)
+ / sizeof (_nl_value_type_LC_CTYPE[0])))
+ || __builtin_expect (_nl_value_types[category][cnt] != word, 1))
+ newdata->values[cnt].string = newdata->filedata + idx;
+ else
{
if (idx % __alignof__ (u_int32_t) != 0)
goto puntdata;
newdata->values[cnt].word =
*((const u_int32_t *) (newdata->filedata + idx));
}
- else
- newdata->values[cnt].string = newdata->filedata + idx;
}
return newdata;