From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by sourceware.org (Postfix) with ESMTPS id 089763858409 for ; Wed, 20 Oct 2021 15:12:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 089763858409 Received: by mail-ua1-x92c.google.com with SMTP id q13so7303077uaq.2 for ; Wed, 20 Oct 2021 08:12:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=k0ZuWgIArRcO2m+gPZ/A+30rM3OetJuCBLSX1pN4tZI=; b=xYUCDBIWZA+I8uj4oFcUbq4nBg9nPv7L5HpmzgQlW9eOP5cQIY+DopPhJSTB0weAuh wUf09BAdflWR4MpaLTmPQ4QXJOJUDmI2mrjHrBCuFdCZAtv9hVH04Z4kpG2t37SUL6GF KjqcCy9bMVEIdHfNmKuFyFznbpY6aRiB8Syen3+wkknJaOcs1bsDMewhyJxrlXfdZKz4 MiNfL2q56h295W7Jh+t14tWQGRfq9104ZGue/wi+uy0cc/RHRTEAoMYqEDaUKMMAFc4e 7GN8RUlgPJ/qN3fXjR4UPFUdI26D7rm9+sn9ozn9TcNbmh5NKe9k3klcFJvISTboUr6H CwbQ== X-Gm-Message-State: AOAM533/c+xlfOr/kzNNSZrGVfDEQses+QdOGUH/a51FWD6a2Pl/5437 f1vA6+phcxq6Gj5wla607zmI4A== X-Google-Smtp-Source: ABdhPJzh63HAO0C9gCNu7R04OD1Ma6TFYSYGWsvqBTgrul0an28MgwW6VMCtAaXSUso/wjoEu2Vbhw== X-Received: by 2002:ab0:3d06:: with SMTP id f6mr173719uax.65.1634742746617; Wed, 20 Oct 2021 08:12:26 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:2654:6d0a:89c6:4739:ceb5? ([2804:431:c7ca:2654:6d0a:89c6:4739:ceb5]) by smtp.gmail.com with ESMTPSA id l10sm1363361vsj.27.2021.10.20.08.12.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Oct 2021 08:12:26 -0700 (PDT) Message-ID: Date: Wed, 20 Oct 2021 12:12:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha Cc: Paul Eggert , bug-gnulib@gnu.org References: <20210104202528.1228255-1-adhemerval.zanella@linaro.org> <20210104202528.1228255-2-adhemerval.zanella@linaro.org> <87h7ller7l.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87h7ller7l.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 20 Oct 2021 15:12:28 -0000 On 08/03/2021 09:59, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> - else if (*p == L_('|')) >> + else if (*p == L_(')') || *p == L_('|')) >> { >> if (level == 0) >> { >> - NEW_PATTERN; >> - startp = p + 1; >> + size_t slen = opt == L_('?') || opt == L_('@') >> + ? pattern_len : p - startp + 1; >> + CHAR *newp = malloc (slen * sizeof (CHAR)); >> + if (newp != NULL) >> + { >> + *((CHAR *) MEMPCPY (newp, startp, p - startp)) = L_('\0'); >> + PASTE (PATTERN_PREFIX,_add) (&list, newp); >> + } >> + if (newp == NULL || PASTE (PATTERN_PREFIX, _has_failed) (&list)) >> + { >> + retval = -2; >> + goto out; >> + } >> + >> + if (*p == L_('|')) >> + startp = p + 1; >> } > > slen seems to be the wrong variable name. But I don't know wh the > original code computes plen conditionally and then uses p - startp > unconditionally. That seems wrong. The discrepancy goes back to > 821a6bb4360. Do you see a case where the difference matters? > > The == 0 checks for the recursive FCT calls are wrong because they treat > match failure the same as OOM and other errors (the -2 return value), > but that also is a pre-existing issue. > > The conversation itself appears to be faithful. Hi Florian, I noted this patch [1] is marked accepted, was you the one that accepted it? In any case, are you still ok with the change? [1] https://patchwork.sourceware.org/project/glibc/patch/20210202130804.1920933-2-adhemerval.zanella@linaro.org/