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]

Re: [PATCH] locale: Avoid zero-length array in _nl_category_names [BZ #24962]


On 9/5/19 7:25 AM, Jeff Law wrote:
On 9/5/19 1:34 AM, Florian Weimer wrote:
(Martin, can you give this a test using GCC 10?  I don't expect any
issues because the zero-length array is completely gone.  The patch
passed testing on x86_64-linux-gnu without regressions, but with GCC 9.)

The union wrapper is unnecessary because C allows to read any object
as a sequence of chars.

2019-09-05  Florian Weimer  <fweimer@redhat.com>

	[BZ #24962]
	* locale/localeinfo.h (_nl_category_names): Remove union wrapper.
	(_nl_category_names_get): New function.
	* intl/dcigettext.c (category_to_name): Call it.
	* locale/findlocale.c (_nl_find_locale): Likewise.
	* intl/loadlocale.c (_nl_load_locale): Likewise.
	* locale/newlocale.c (__newlocale): Likewise.
	* locale/setlocale.c (_nl_category_names): Adjust definition.
	(_nl_category_name_idxs): Likewise.
	(new_composite_name): Call _nl_category_names_get.
	(setlocale): Likewise.
Might be easier for me than Martin.  I just threw it into my github
repo, so my tester will pick it up as of now.  Will report back in a few
hours.

Thanks Jeff.  I'm sure your coverage will be more comprehensive
than mine.  (The warning Florian is fixing only shows up with
the patch for PR 91631 I posted yesterday so you need both in
your tested to verify them.)

It's pretty easy for me to test it on x86_64-linux: with your
patch, Florian, and my enhanced GCC 10 I don't see any warnings.

Martin


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