This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix handling of collating elements in fnmatch (bug 17396, bug 16976)
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 07 Jan 2019 16:26:06 +0100
- Subject: Re: [PATCH] Fix handling of collating elements in fnmatch (bug 17396, bug 16976)
- References: <mvmin00844a.fsf@suse.de>
* Andreas Schwab:
> This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
> regexp matching. As a side effect it also removes the use of an unbound
> VLA.
>
> [BZ #16976]
> [BZ #17396]
> * posix/fnmatch_loop.c (internal_fnmatch, internal_fnwmatch): When
> looking up collating elements match against (wide) character
> sequence instead of name. Correct alignment adjustment.
> * posix/fnmatch.c: Don't include "../locale/elem-hash.h".
> * posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5.
> (LOCALES): Add cs_CZ.ISO-8859-2.
> * posix/tst-fnmatch4.c: New file.
> * posix/tst-fnmatch5.c: New file.
> + /* Compare the wide char sequence. */
> + && memcmp (startp + 1, &wextra[1],
> + c1 * sizeof (UCHAR)) == 0)
Could this use wmemcmp?
> + if (/* Compare the length of the
> + sequence. */
> + c1 == wextra[0]
> + /* Compare the wide char sequence. */
> + && memcmp (startp + 1, &wextra[1],
> + c1 * sizeof (int32_t)) == 0)
Likewise: Could this use wmemcmp?
Rest of the patch looks fine to me, as far as I can judge such matters.
Please note: The copyright year on the new files needs to be adjusted.
Thanks,
Florian