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.9 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,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 368071F670 for ; Mon, 25 Oct 2021 22:19:15 +0000 (UTC) Received: from localhost ([::1]:42548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mf8JG-0006VA-BL for normalperson@yhbt.net; Mon, 25 Oct 2021 18:19:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf7xP-0006Ew-6P for bug-gnulib@gnu.org; Mon, 25 Oct 2021 17:56:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf7x8-0002rN-UU for bug-gnulib@gnu.org; Mon, 25 Oct 2021 17:56:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635198982; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TPsYaj2NbhUDEQwkT8tCHvJvWMKOTAfhkWzqhG2drOE=; b=iIQ+cXvmyndp0wC39YMBxL6c25YmuGgxqhgvJe798lT0/VbVL3iNsixkfbaSevLxCYA5H9 cXVM+qeqiRs7PDpp+QdvTzwL/cwf8bms8jUnf/afUamBQkjwjmpbegt3TXviMrqqvS1CmU wPWm3+zLYkAIvsLLzKnSzBtC6jlI4Ys= 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-591-4xhKXDxOOQKFfTJM8345bg-1; Mon, 25 Oct 2021 17:56:18 -0400 X-MC-Unique: 4xhKXDxOOQKFfTJM8345bg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EB708066F3; Mon, 25 Oct 2021 21:56:17 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.50.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD6C19C79; Mon, 25 Oct 2021 21:56:16 +0000 (UTC) From: Robbie Harwood To: bug-gnulib@gnu.org Subject: [PATCH 04/11] gnulib/regexec: Resolve unused variable Date: Mon, 25 Oct 2021 17:55:37 -0400 Message-Id: <20211025215543.111906-5-rharwood@redhat.com> In-Reply-To: <20211025215543.111906-1-rharwood@redhat.com> References: <20211025215543.111906-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=rharwood@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 25 Oct 2021 18:17:19 -0400 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: Darren Kenny , Daniel Kiper , Robbie Harwood Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" From: Darren Kenny This is a really minor issue where a variable is being assigned to but not checked before it is overwritten again. The reason for this issue is that we are not building with DEBUG set and this in turn means that the assert() that reads the value of the variable match_last is being processed out. The solution, move the assignment to match_last in to an ifdef DEBUG too. Fixes: CID 292459 Signed-off-by: Darren Kenny Reviewed-by: Daniel Kiper Signed-off-by: Robbie Harwood --- lib/regexec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/regexec.c b/lib/regexec.c index e48fe5333..90330ef39 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -815,7 +815,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, break; if (__glibc_unlikely (err != REG_NOMATCH)) goto free_return; +#ifdef DEBUG + /* Only used for assertion below when DEBUG is set, otherwise + it will be over-written when we loop around. */ match_last = -1; +#endif } else break; /* We found a match. */ -- 2.33.0