This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][BZ 19084] Make sure _nl_value_type_LC_<category> arrays have correct size.


Otherwise if the last element of a category is an array (stringarray,
wstringarray etc.) this array will count only the first element
of the array element and will not load a category, will complain
that a locale file is too long.

Probably related with bug 19084.
---
 ChangeLog           | 4 ++++
 locale/loadlocale.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ad37067..cf201a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-03-19  Rafal Luzynski  <digitalfreak@lingonborough.com>
+	* locale/loadlocale.c: Make sure _nl_value_type_LC_<category>
+	arrays have correct size.  Probably related with bug 19084.
+
 2016-03-17  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_EVENTFD2):
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 2b589ee..2f2025c 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -45,7 +45,8 @@ static const size_t _nl_category_num_items[] =
 #define NO_PAREN(arg, rest...) arg, ##rest
 
 #define DEFINE_CATEGORY(category, category_name, items, a) \
-static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
+static const enum value_type _nl_value_type_##category     \
+  [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items };
 #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
   [_NL_ITEM_INDEX (element)] = type,
 #include "categories.def"
-- 
2.5.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]