diff options
author | Norihiro Tanaka <noritnk@kcn.ne.jp> | 2014-12-02 22:45:17 +0900 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2014-12-06 22:11:46 -0800 |
commit | 08f909e5cfcd8ee35a6336559322dfb38087c907 (patch) | |
tree | 9ae064876963a38bf8cd04acc8069292d6d64279 /cfg.mk | |
parent | c8b9364d5900a40809827aee6cc53705073278f6 (diff) | |
download | grep-08f909e5cfcd8ee35a6336559322dfb38087c907.tar.gz |
dfa: avoid invalid match or infinite loop in unused matching mode
Neither grep nor gawk uses this DFA code in its matching mode,
since each always calls dfacomp with a nonzero final argument.
However, when used in that mode, it had bug:
After failing to match in matching mode, it should return NULL,
but instead would either report a false match or enter an
infinite loop.
* src/dfa.c (dfaexec_main): After failing to match in matching mode
return NULL, rather than transitioning to the next state.
* tests/dfa-match: Add a new test.
* tests/dfa-match-aux.c: Add a new program to exercise this
otherwise-unused part of dfa.c.
* tests/Makefile.am: Add a rule to build new test.
(check_PROGRAMS): Add dfa-match-aux.
(AM_CPPFLAGS): Add -I$(top_srcdir)/src.
(TESTS): Add dfa-match.
* cfg.mk (exclude_file_name_regexp--sc_bindtextdomain):
(exclude_file_name_regexp--sc_prohibit_atoi_atof):
Exempt the new test file from some syntax-check rules.
Diffstat (limited to 'cfg.mk')
-rw-r--r-- | cfg.mk | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -118,7 +118,11 @@ update-copyright-env = \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 -exclude_file_name_regexp--sc_bindtextdomain = ^tests/get-mb-cur-max\.c$$ +exclude_file_name_regexp--sc_bindtextdomain = \ + ^tests/(get-mb-cur-max|dfa-match-aux)\.c$$ +exclude_file_name_regexp--sc_prohibit_atoi_atof = \ + ^tests/dfa-match-aux\.c$$ + exclude_file_name_regexp--sc_prohibit_strcmp = /colorize-.*\.c$$ exclude_file_name_regexp--sc_prohibit_xalloc_without_use = ^src/kwset\.c$$ exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \ |