This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch master updated. glibc-2.26.9000-676-gf301e53


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  f301e5334065e93aace667fd4a87bce6fc1dbd13 (commit)
      from  7e9d70736b98950522549e63d5bb7f81ff9eb93b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f301e5334065e93aace667fd4a87bce6fc1dbd13

commit f301e5334065e93aace667fd4a87bce6fc1dbd13
Author: Rafal Luzynski <digitalfreak@lingonborough.com>
Date:   Wed Jul 12 01:32:33 2017 +0200

    Correct the size of _nl_value_type_LC_... arrays.
    
    There were several problems with checking the array size in the past,
    for example BZ#356, caused by incorrectly assuming that every locale
    token represents one element.  In fact, if a token represented
    a subarray, for example an array of month names or characters category
    and it appeared at the end of the array the compiler assumed that
    the array ends just after the first element of the subarray.
    A workaround used in the past was to skip some categories while testing,
    for example LC_CTYPE.  Now when we are about to add alternative month
    names to LC_TIME (BZ#10871) this will fail again.
    
    	* locale/loadlocale.c: Correct size of
    	_nl_value_type_LC_<category> arrays.
    
    Reviewed-by: Zack Weinberg <zackw@panix.com>

diff --git a/ChangeLog b/ChangeLog
index 61bbfa6..a8c89b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-27  Rafal Luzynski  <digitalfreak@lingonborough.com>
+
+	* locale/loadlocale.c: Correct size of
+	_nl_value_type_LC_<category> arrays.
+
 2017-10-27  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/math.h [__HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !_LIBC)]:
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 2bdb39b..2dba86d 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -44,8 +44,12 @@ static const size_t _nl_category_num_items[] =
 
 #define NO_PAREN(arg, rest...) arg, ##rest
 
+/* The size of the array must be specified explicitly because some of
+   the 'items' may be subarrays, which will cause the compiler to deduce
+   an incorrect size from the initializer.  */
 #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"

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    5 +++++
 locale/loadlocale.c |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


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