From patchwork Wed Aug 21 18:08:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 34233 Received: (qmail 89960 invoked by alias); 21 Aug 2019 18:08:54 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 89945 invoked by uid 89); 21 Aug 2019 18:08:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=cid, HX-Languages-Length:1694 X-HELO: zimbra.cs.ucla.edu Subject: Re: Eliminate dead assignment in regex_internal.c/re_node_set_insert() To: =?UTF-8?Q?Tim_R=c3=bchsen?= References: <5a4c99bb-ae41-271b-8677-b8bc9e08ec10@gmx.de> Cc: bug-gnulib@gnu.org, GNU C Library From: Paul Eggert Message-ID: <43b969fe-07d4-8b55-13e3-0f9e75fd5e22@cs.ucla.edu> Date: Wed, 21 Aug 2019 11:08:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <5a4c99bb-ae41-271b-8677-b8bc9e08ec10@gmx.de> Thanks for reporting the issue. That Gnulib file is shared with glibc, so I installed the attached obvious fix there and am cc'ing the glibc list. From f615e3fced100914b1ee4d690f380deb69a4be70 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 21 Aug 2019 09:29:09 -0700 Subject: [PATCH] Remove dead regex code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * posix/regex_internal.c (re_node_set_insert): Remove unnecessary assignment. Reported by Tim Rühsen in: https://lists.gnu.org/r/bug-gnulib/2019-08/msg00026.html --- ChangeLog | 5 +++++ posix/regex_internal.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2db09d2f18..182aa13353 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2019-08-21 Paul Eggert + Remove dead regex code + * posix/regex_internal.c (re_node_set_insert): + Remove unnecessary assignment. Reported by Tim Rühsen in: + https://lists.gnu.org/r/bug-gnulib/2019-08/msg00026.html + Fix bad pointer / leak in regex code This was found by Coverity (CID 1484201). [BZ#24844] * posix/regex_internal.c (create_cd_newstate): Fix use of bad diff --git a/posix/regex_internal.c b/posix/regex_internal.c index f53ded93a8..99fbb26ecb 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -1311,7 +1311,6 @@ re_node_set_insert (re_node_set *set, Idx elem) first element separately to skip a check in the inner loop. */ if (elem < set->elems[0]) { - idx = 0; for (idx = set->nelem; idx > 0; idx--) set->elems[idx] = set->elems[idx - 1]; } -- 2.21.0