Subject: bug#18631: closed (Re: bug#18631: [PATCH] dfa: return NULL as can't find any predicates)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 25 Apr 2015 19:50:03 +0000

Your bug report

#18631: [PATCH] dfa: return NULL as can't find any predicates

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].

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

Subject: Re: bug#18631: [PATCH] dfa: return NULL as can't find any predicates
From: Jim Meyering <[email-masked]>
To: Norihiro Tanaka <[email-masked]>
Cc: [email-masked]
Date: Sat, 25 Apr 2015 12:48:46 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On Sun, Dec 7, 2014 at 6:06 AM, Norihiro Tanaka <[email-masked]> wrote:
> On Sun, 05 Oct 2014 12:33:45 +0900
> Norihiro Tanaka <[email-masked]> wrote:
>
>> find_pred function is return an address to NULL pointer, but I think we
>> don't hope it.  So fix it.
>>
>> BTW, it could never happen, as the syntax is checked in regex prior to it.
>
> I wrote and added a test driver for this bug which uses a program
> `dfa-match-aux' added for tests recently.
>
> The program will generate a core dump before the change.

Thank you for the patch.
I have added to the commit log and adjusted the Makefile.am change
to insert the new test name in alphabetical order. I will push this shortly:

Subject: [PATCH] dfa: return NULL as can't find any predicates
From: Norihiro Tanaka <[email-masked]>
To: [email-masked]
Date: Sun, 05 Oct 2014 12:33:45 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

find_pred function is return an address to NULL pointer, but I think we
don't hope it.  So fix it.

BTW, it could never happen, as the syntax is checked in regex prior to it.
From ff7e6f5994b8f90aaeb85da6b31569f01f97f2f4 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Sun, 5 Oct 2014 12:09:24 +0900
Subject: [PATCH] dfa: return NULL as can't find any predicates

* src/dfa.c (find_pred): Return NULL as can't find any predicates.
---
 src/dfa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index 4f45fff..d2515fc 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -965,9 +965,9 @@ find_pred (const char *str)
   unsigned int i;
   for (i = 0; prednames[i].name; ++i)
     if (STREQ (str, prednames[i].name))
-      break;
+      return &prednames[i];
 
-  return &prednames[i];
+  return NULL;
 }
 
 /* Multibyte character handling sub-routine for lex.
-- 
2.1.1