summaryrefslogtreecommitdiff
path: root/pcre/pcregrep.c
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-03-05 02:27:59 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-03-05 02:27:59 +0200
commitdfd7749120e592299fddf2710bc336ee1000ae07 (patch)
treec0c471eaf9eecb69f2d8eddcad96f951796362cf /pcre/pcregrep.c
parent1592fbd332373a110edcc28468cd8dc2b99271ef (diff)
downloadmariadb-git-dfd7749120e592299fddf2710bc336ee1000ae07.tar.gz
8.40
Diffstat (limited to 'pcre/pcregrep.c')
-rw-r--r--pcre/pcregrep.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c
index cd53c648da2..fd2a67622ba 100644
--- a/pcre/pcregrep.c
+++ b/pcre/pcregrep.c
@@ -1803,6 +1803,12 @@ while (ptr < endptr)
match = FALSE;
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
+
+ /* If the current match ended past the end of the line (only possible
+ in multiline mode), we are done with this line. */
+
+ if ((unsigned int)offsets[1] > linelength) goto END_ONE_MATCH;
+
startoffset = offsets[1]; /* Restart after the match */
if (startoffset <= oldstartoffset)
{