grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v2.21-27-g599c2af


From: Jim Meyering
Subject: grep branch, master, updated. v2.21-27-g599c2af
Date: Sat, 25 Apr 2015 22:37:06 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  599c2afbc8274d190739a623c45498b317e7f29c (commit)
      from  8ee53e2a2804a7cecda91a5e249aa29e6c18f65a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=599c2afbc8274d190739a623c45498b317e7f29c


commit 599c2afbc8274d190739a623c45498b317e7f29c
Author: Norihiro Tanaka <address@hidden>
Date:   Sun Oct 5 12:09:24 2014 +0900

    dfa: make find_pred return NULL for an invalid predicate
    
    This could never happen when invoked via grep, but could have triggered
    a bug if dfa.c's find_pred function were invoked by some other program.
    * src/dfa.c (find_pred): Return NULL for an invalid predicate.
    * tests/invalid-char-class: New file to test for this.
    * tests/Makefile.am (TESTS): Add that new file name to the list.
    This addresses http://debbugs.gnu.org/18631

diff --git a/src/dfa.c b/src/dfa.c
index 6c46919..8901f69 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -971,9 +971,8 @@ 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.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 33b6adc..53c2f94 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -73,6 +73,7 @@ TESTS =                                               \
   in-eq-out-infloop                            \
   include-exclude                              \
   inconsistent-range                           \
+  invalid-char-class                           \
   invalid-multibyte-infloop                    \
   khadafy                                      \
   kwset-abuse                                  \
diff --git a/tests/invalid-char-class b/tests/invalid-char-class
new file mode 100755
index 0000000..5060b50
--- /dev/null
+++ b/tests/invalid-char-class
@@ -0,0 +1,30 @@
+#!/bin/sh
+# This use of our DFA-testing helper would fail for grep-2.21.
+
+# Copyright 2014-2015 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+# Add "." to PATH for the use of dfa-match-aux.
+path_prepend_ .
+
+fail=0
+
+echo 'dfaerror: invalid character class' > exp
+LC_ALL=C dfa-match-aux '[[:foo:]]' a > out 2>&1
+compare exp out || fail=1
+
+Exit $fail

-----------------------------------------------------------------------

Summary of changes:
 src/dfa.c                                          |    5 ++---
 tests/Makefile.am                                  |    1 +
 ...ibyte-negated-circumflex => invalid-char-class} |   13 ++++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)
 copy tests/{unibyte-negated-circumflex => invalid-char-class} (75%)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]