From patchwork Tue May 23 07:37:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carlo Arenas X-Patchwork-Id: 55789 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 0DB0D385B53E for ; Tue, 23 May 2023 07:38:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DB0D385B53E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684827507; bh=8RGTqdralP7NPTkHxCbpYTDd1E4/4W/UkqCa2Piz/h4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=b0ZdtJNzA8iuDYuv/rTYdTTZvvgdguqOEirQOkqHug5RKll/5psPLEmfbCkAtxFOq lxigqXf9665+TFmqezCQiOkOpZTPqWX6I7CLSlhWqzDjYWSNRKkTOdEJwgqwrneMz4 takYLcDkntSOQh/B/YWHGtba4BEgi6RLp8qmz2SE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 02F933858D37 for ; Tue, 23 May 2023 07:38:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02F933858D37 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-25394160fd3so2579876a91.3 for ; Tue, 23 May 2023 00:38:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684827482; x=1687419482; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8RGTqdralP7NPTkHxCbpYTDd1E4/4W/UkqCa2Piz/h4=; b=CUMlkDTPGJRXa1gNNp2cvU16oEOqmbx+Vu9D6KYu8i0pHN85NAmEvL/rUwbbkpy/dI //mRvgrfa1Yw3CR9Uoxf8bjs6BE9/RaC2VEP2/mOmm/+od9818SzqnSxynRbqXCdTagx iMSizqkcR02ynl4vUmHlpXY2nLmdBDIlI/nFmESMBbp8rmppw76RS5FfWQQEW6hujGjT TfcFOjJKt3BXQiDEkeJBXjPhylol+47Dft/+d7bOkX44UGKzlMQxXTkOxqITMOsvCUS7 LVt5ADwz6I7kGK7M77n9DTg65puoVjd7/wWoAQl7ud+pFep4J1fHzg8ly3UYEweFSrNH iiMw== X-Gm-Message-State: AC+VfDyHQf7AQ3GbVP+NJPY7ovrj3k+wHpkuBF3xa+8H89r5Q6Cvvexu +qwMmaPRvgmIhtb9JiRL5uMpA114D38= X-Google-Smtp-Source: ACHHUZ4trmkKig+OM/z8tvIpqS1uum5ajlyGNDurGndpQi6w5VoS9TF+u6iOueQ8f+k2vKfBVj6YOQ== X-Received: by 2002:a17:90b:33d2:b0:24e:29f1:dbd2 with SMTP id lk18-20020a17090b33d200b0024e29f1dbd2mr12786128pjb.1.1684827482448; Tue, 23 May 2023 00:38:02 -0700 (PDT) Received: from localhost.localdomain (192-184-219-167.fiber.dynamic.sonic.net. [192.184.219.167]) by smtp.gmail.com with ESMTPSA id g6-20020a635206000000b0053051d50a48sm5410027pgb.79.2023.05.23.00.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 00:38:01 -0700 (PDT) To: libc-alpha@sourceware.org Cc: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Subject: [PATCH 0/2] posix: fix fnmatch() inconsistency BZ#30483 Date: Tue, 23 May 2023 00:37:30 -0700 Message-Id: <20230523073732.6956-1-carenas@gmail.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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?q?Carlo_Marcelo_Arenas_Bel=C3=B3n_via_Libc-alpha?= From: Carlo Arenas Reply-To: =?utf-8?q?Carlo_Marcelo_Arenas_Bel=C3=B3n?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Always verify that the class name provided as part of the pattern is a valid one before returning a result, so fnmatch() wouldn't mistakenly return 0 if there was a match but the rest of the bracket expression is not valid. Note that for most other cases there were already hard failures and class name that exceeds the maximum was one of those, so the lack of hard failures might had been caused by the original copy and adaptation of the code that matches the first expression. First patch fixes an even older bug and that is partially covered in the proposed fix for the issue that is included with the second. I didn't include a regression test to try to keep the change minimal. I did FSF copyright assignment for GNU grep before, if that is relevant for this series. Tested on x86_64-pc-linux-gnu Carlo Marcelo Arenas Belón (2): fnmatch: allow character class names with 'z' posix: correctly detect invalid classes after match in fnmatch() posix/fnmatch_loop.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)