summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rwxr-xr-xRunGrepTest4
-rw-r--r--pcregrep.c2
-rw-r--r--testdata/grepoutput3
4 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 38b2df6..eb37dea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -57,6 +57,9 @@ Version 8.34 xx-xxxx-201x
item was recorded. For example, the pattern (?(?=ab)ab) recorded "a" as a
first data item, and therefore matched "ca" after "c" instead of at the
start.
+
+11. Change 40 for 8.33 (allowing pcregrep to find empty strings) showed up a
+ bug that caused the command "echo a | ./pcregrep -M '|a'" to loop.
Version 8.33 28-May-2013
diff --git a/RunGrepTest b/RunGrepTest
index daaf8af..e192ed7 100755
--- a/RunGrepTest
+++ b/RunGrepTest
@@ -502,6 +502,10 @@ echo "---------------------------- Test 105 -----------------------------" >>tes
(cd $srcdir; $valgrind $pcregrep --colour=always "ipsum|" ./testdata/grepinput3) >>testtry 2>&1
echo "RC=$?" >>testtry
+echo "---------------------------- Test 106 -----------------------------" >>testtry
+(cd $srcdir; echo "a" | $valgrind $pcregrep -M "|a" ) >>testtry 2>&1
+echo "RC=$?" >>testtry
+
# Now compare the results.
diff --git a/pcregrep.c b/pcregrep.c
index 6402348..6b15765 100644
--- a/pcregrep.c
+++ b/pcregrep.c
@@ -1835,7 +1835,7 @@ while (ptr < endptr)
{
char *endmatch = ptr + offsets[1];
t = ptr;
- while (t < endmatch)
+ while (t <= endmatch)
{
t = end_of_line(t, endptr, &endlinelength);
if (t < endmatch) linenumber++; else break;
diff --git a/testdata/grepoutput b/testdata/grepoutput
index cf04091..9bf9d9d 100644
--- a/testdata/grepoutput
+++ b/testdata/grepoutput
@@ -740,3 +740,6 @@ RC=0

triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt
RC=0
+---------------------------- Test 106 -----------------------------
+a
+RC=0