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-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham 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 75B971F9FD for ; Mon, 8 Mar 2021 13:58:39 +0000 (UTC) Received: from localhost ([::1]:35624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJGP7-0000YE-TA for normalperson@yhbt.net; Mon, 08 Mar 2021 08:58:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJFUZ-0000Ag-HC for bug-gnulib@gnu.org; Mon, 08 Mar 2021 08:00:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lJFUW-0004uT-SY for bug-gnulib@gnu.org; Mon, 08 Mar 2021 08:00:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615208406; 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=XFzsMjwsbc4kCyzorP7hHM737r0cuW91E04z0XYWXWY=; b=PFOts3xFF+/+YGBz5QJL1ReNwSJ7gmtnPBTW2P5WvDn548qU1Yj37ZHFnidEu+m0LOoJOG s6BKo4qE/SuO/hl/zbgHf2Dr5b25A/jlAbsS4CIhI9g8wxVFR8pmN6JLId05g0dXjSsu/1 MbOBQb4NstRYW8bYWOpnN57TWdjQz+g= 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-602-2hIe3WoAN0aWJjINBmb_-g-1; Mon, 08 Mar 2021 08:00:04 -0500 X-MC-Unique: 2hIe3WoAN0aWJjINBmb_-g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45E221092956; Mon, 8 Mar 2021 12:59:39 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-77.ams2.redhat.com [10.36.112.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 165355D6D5; Mon, 8 Mar 2021 12:59:37 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha 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> Date: Mon, 08 Mar 2021 13:59:42 +0100 In-Reply-To: <20210104202528.1228255-2-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Mon, 4 Jan 2021 17:25:28 -0300") Message-ID: <87h7ller7l.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=63.128.21.124; envelope-from=fweimer@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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: Paul Eggert , bug-gnulib@gnu.org, Adhemerval Zanella Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * 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. Thanks, Florian