summaryrefslogtreecommitdiff
path: root/ext/pcre/pcrelib/pcre.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcre/pcrelib/pcre.c')
-rw-r--r--ext/pcre/pcrelib/pcre.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/pcre/pcrelib/pcre.c b/ext/pcre/pcrelib/pcre.c
index dd5852dd31..caeeaa4971 100644
--- a/ext/pcre/pcrelib/pcre.c
+++ b/ext/pcre/pcrelib/pcre.c
@@ -4125,7 +4125,7 @@ Returns: > 0 => success; value is the number of elements filled in
int
pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
- const char *subject, int length, int options, int *offsets, int offsetcount)
+ const char *subject, int length, int options, int *offsets, int offsetcount, int minlen)
{
int resetcount, ocount;
int first_char = -1;
@@ -4287,6 +4287,10 @@ do
if (!match(start_match, re->code, 2, &match_block, ims, FALSE, start_match))
continue;
+ /* Check that the match is not closer than minlen (Andrey Zmievski) */
+ if (start_match - match_block.start_subject < minlen)
+ continue;
+
/* Copy the offset information from temporary store if necessary */
if (using_temporary_offsets)