From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6C91B1F670 for ; Thu, 21 Oct 2021 09:56:09 +0000 (UTC) Received: from localhost ([::1]:43314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdUnw-0008SP-1g for normalperson@yhbt.net; Thu, 21 Oct 2021 05:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdUnt-0008SD-G2 for bug-gnulib@gnu.org; Thu, 21 Oct 2021 05:56:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdUnq-0005RJ-T3 for bug-gnulib@gnu.org; Thu, 21 Oct 2021 05:56:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634810162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VSbjScXZUeurRpbrvCMIKXX//06KlJmWnKhoHq6JmKo=; b=h86m8btQXQoEmoEocLwcLesea8UP9YqWtcOwEhgwxn4fR0RoOdD2UP0hkRjYmyPKlvxRsq 3wDV827+cz4xj9CLDTqhFNopPaP9mEuQlVpxNO8htv52nj1BrYpwapUDkDEYTufM5z/5MW nZPEQEnNLwE84VZLp8l5/hmqWoSECx0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-94-C80paU9OP_iV80m3SUvtKA-1; Thu, 21 Oct 2021 05:54:52 -0400 X-MC-Unique: C80paU9OP_iV80m3SUvtKA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 607829126B; Thu, 21 Oct 2021 09:54:51 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7FBDADD8; Thu, 21 Oct 2021 09:54:49 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Subject: Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation References: <20210104202528.1228255-1-adhemerval.zanella@linaro.org> <20210104202528.1228255-2-adhemerval.zanella@linaro.org> <87h7ller7l.fsf@oldenburg.str.redhat.com> Date: Thu, 21 Oct 2021 11:54:47 +0200 In-Reply-To: (Adhemerval Zanella's message of "Wed, 20 Oct 2021 12:12:24 -0300") Message-ID: <87sfwusnx4.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=fweimer@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=170.10.133.124; envelope-from=fweimer@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org, Paul Eggert , Adhemerval Zanella via Libc-alpha Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * Adhemerval Zanella: > 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/ I think all the issues I identified are pre-existing, and as I said, the conversion to remove alloca appears to be correct. Thanks, Florian