diff options
author | Norihiro Tanaka <noritnk@kcn.ne.jp> | 2014-10-05 12:09:24 +0900 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2015-04-25 12:44:01 -0700 |
commit | 599c2afbc8274d190739a623c45498b317e7f29c (patch) | |
tree | f2f1d9357eadd6b60eba0b1ff807962f50b0253d /src | |
parent | 8ee53e2a2804a7cecda91a5e249aa29e6c18f65a (diff) | |
download | grep-599c2afbc8274d190739a623c45498b317e7f29c.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/dfa.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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. |