From patchwork Sat Apr 22 02:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 68155 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E68CB385770E for ; Sat, 22 Apr 2023 02:22:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E68CB385770E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682130177; bh=WyeJ09umOc8G664O4SydfXz7fDt4yZ3bB0rvUTLESUs=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=wqr1hx4NLLENlcgknVdoepRgVIBLnBoatSd8fc6K5R3Qp0E/9RBeINJvO1G8rPUPO 2BV0WYsbQnKXgHt0hmgYCcTHLeJi/ukIA985z2IWHTvhmd5RlN5VaqRHk9n3DX74iP /YegOtSvhsB4zSiHrNQSf+99i+5oRvFzjjE1zvbo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by sourceware.org (Postfix) with ESMTP id CE0BA3857732 for ; Sat, 22 Apr 2023 02:22:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE0BA3857732 Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id B13C06936 for ; Sat, 22 Apr 2023 04:22:34 +0200 (CEST) Date: Sat, 22 Apr 2023 04:22:33 +0200 To: libc-alpha@sourceware.org Subject: [PATCH 2/3] posix: regcomp(): clear RE_DOT_NOT_NULL Message-ID: References: <6ae8f638ecd1a0f0d76a104c8903baf96ecd317a.1682130047.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6ae8f638ecd1a0f0d76a104c8903baf96ecd317a.1682130047.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20230407 X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RDNS_DYNAMIC, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?b?0L3QsNCxIHZpYSBMaWJjLWFscGhh?= From: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= Reply-To: =?utf-8?b?0L3QsNCx?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The POSIX API always stops at first NUL so there's no change for that. The BSD REG_STARTEND API, with its explicit range, can include NULs within that range, and those NULs are matched with . and [^]. Heretofor, for a string of "a\0c", glibc would match "[^q]c", but not ".c". This is both inconsistent and nonconformant to BSD REG_STARTEND. With this patch, they're identical like you'd expect, and the tst-reg-startend.c: ..c: a^@c: no match$ failure is removed. Another approach would be to remove it from _RE_SYNTAX_POSIX_COMMON, but it's unclear to me what the custody chain is like for that and what other regex APIs glibc offers that could be affected by this. Signed-off-by: Ahelenia ZiemiaƄska --- Please keep me in CC, as I'm not subscribed. posix/regcomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posix/regcomp.c b/posix/regcomp.c index 647b18ba9e..cbd9bfc673 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -462,7 +462,7 @@ regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED - : RE_SYNTAX_POSIX_BASIC); + : RE_SYNTAX_POSIX_BASIC) & ~RE_DOT_NOT_NULL; preg->buffer = NULL; preg->allocated = 0;