Subject: [PATCH] grep: no count newline at the head of a text buffer

From: Norihiro Tanaka <[email-masked]>
Date: Sat, 17 May 2014 10:20:51 +0900

Severity: critical

When cleared caches of transition tables, number of newline is counted
incorrectly, As a result, grep may crash.

I confirmed crash of grep with a text case in bug#15191

  http://dobrokot.ru/dump/slow_dfa_merge.2013-08-26.tar.gz

  $ env LC_ALL=C time -p src/egrep -f regex.re input_lines.txt

When `p' is beginning, p[-1] is out of the buffer.  Therefore, we
shouldn't count it.

Norihiro