From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58010 invoked by alias); 7 Jan 2019 15:26:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 57597 invoked by uid 89); 7 Jan 2019 15:26:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=judge X-HELO: mx1.redhat.com From: Florian Weimer To: Andreas Schwab Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Fix handling of collating elements in fnmatch (bug 17396, bug 16976) References: Date: Mon, 07 Jan 2019 15:26:00 -0000 In-Reply-To: (Andreas Schwab's message of "Tue, 11 Dec 2018 16:39:17 +0100") Message-ID: <87zhscfq0h.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-01/txt/msg00165.txt.bz2 * 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