Subject: bug#21273: closed (Re: bug#21273: [PATCH] grep: avoid use of uninitialized variable)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 20 Aug 2015 00:02:03 +0000

Your bug report

#21273: [PATCH] grep: avoid use of uninitialized variable

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21273: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21273
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21273: [PATCH] grep: avoid use of uninitialized variable
From: Jim Meyering <[email-masked]>
To: Norihiro Tanaka <[email-masked]>
Cc: [email-masked]
Date: Wed, 19 Aug 2015 17:00:41 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On Sat, Aug 15, 2015 at 7:17 PM, Norihiro Tanaka <[email-masked]> wrote:
> Uninitialized value of variable BACKREF is referred in EGexecute.  It
> does not cause wrong result, but regex may be used even when it is not
> needed.  It may lead grep to slowdown.
>
> By the way, gawk initializes the variable already, so it does not have
> to be fixed.

Thank you for that fix. I have determined that the problem was
introduced since the latest release, so this does not require a
NEWS entry, then added that info and a paraphrasing of your
comment above to the commit log. Pushed here:

  http://git.savannah.gnu.org/cgit/grep.git/commit/?id=8a33cdeba4ba0

Subject: [PATCH] grep: avoid use of uninitialized variable
From: Norihiro Tanaka <[email-masked]>
To: <[email-masked]>
Date: Sun, 16 Aug 2015 11:17:52 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Uninitialized value of variable BACKREF is referred in EGexecute.  It
does not cause wrong result, but regex may be used even when it is not
needed.  It may lead grep to slowdown.

By the way, gawk initializes the variable already, so it does not have
to be fixed.
From 1103b67eb8cdf02098b09f79d73f26c897e4db96 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Tue, 11 Aug 2015 00:37:00 +0900
Subject: [PATCH] grep: avoid use of uninitialized variable

* src/dfasearch.c (EGexecute): Initialize backref.
---
 src/dfasearch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dfasearch.c b/src/dfasearch.c
index 8b8af06..de51321 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -207,7 +207,6 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
 {
   char const *buflim, *beg, *end, *ptr, *match, *best_match, *mb_start;
   char eol = eolbyte;
-  int backref;
   regoff_t start;
   size_t len, best_len;
   struct kwsmatch kwsm;
@@ -227,6 +226,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
           char const *next_beg, *dfa_beg = beg;
           size_t count = 0;
           bool exact_kwset_match = false;
+          int backref = 0;
 
           /* Try matching with KWset, if it's defined.  */
           if (kwset)
-- 
2.4.6