--- ./src/search.c.orig	2005-07-18 22:19:54.512263500 +0300
+++ ./src/search.c	2005-07-18 22:56:41.990222250 +0300
@@ -702,7 +702,14 @@
       if (!exact)
 	{
 	  end = memchr (end, eol, buflim - end);
-	  end++;
+	  if (end)
+	    {
+	      end++;
+	    }
+	  else
+	   {
+	      end = buflim;
+	   }
 	  while (buf < beg && beg[-1] != eol)
 	    --beg;
 	}
--- ./tests/shlomif1.txt.orig	2005-07-18 22:29:07.942850750 +0300
+++ ./tests/shlomif1.txt	2005-07-18 22:26:38.029481750 +0300
@@ -0,0 +1 @@
++	 
--- ./tests/shlomif1.sh.orig	2005-07-18 22:29:11.799091750 +0300
+++ ./tests/shlomif1.sh	2005-07-18 22:28:27.668333750 +0300
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Regression test for GNU grep.
+
+: ${srcdir=.}
+: ${GREP=../src/grep}
+
+failures=0
+
+# . . . and the following by Henry Spencer.
+
+${GREP} -P '^\+\s*$' shlomif1.txt
+
--- ./tests/Makefile.am.orig	2005-07-18 22:59:55.214298000 +0300
+++ ./tests/Makefile.am	2005-07-18 22:44:40.457129250 +0300
@@ -3,11 +3,15 @@
 AWK=@AWK@
 
 TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \
-        status.sh empty.sh options.sh backref.sh file.sh
+        status.sh empty.sh options.sh backref.sh file.sh \
+        shlomif1.sh
+
 EXTRA_DIST = $(TESTS) \
              khadafy.lines khadafy.regexp \
              spencer1.awk spencer1.tests \
-             bre.awk ere.awk bre.tests ere.tests
+             bre.awk ere.awk bre.tests ere.tests \
+             shlomif1.txt
+
 CLEANFILES = spencer1.script bre.script ere.script khadafy.out patfile
 TESTS_ENVIRONMENT = \
 	AWK=$(AWK) \
