[PATCH] locale: Avoid zero-length array in _nl_category_names [BZ #24962]
Jeff Law
law@redhat.com
Thu Sep 5 14:41:00 GMT 2019
On 9/5/19 8:26 AM, Martin Sebor wrote:
> 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.
ACK. WIll drop in yesterday's GCC patch and restart the relevant builds.
jeff
More information about the Libc-alpha
mailing list