summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2017-06-03 16:47:21 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2017-06-03 16:47:21 +0000
commita475d5de17defb1f76fa188dc65aa6a3371d2134 (patch)
treee7886f7b9ce535de8edc068575e3cc4a6a7cbae4
parentab5f63e3ff84c89aecfc8e8141b8ee732bfa8600 (diff)
downloadpcre-a475d5de17defb1f76fa188dc65aa6a3371d2134.tar.gz
Fix matching offsets from regexec() in the POSIX wrapper when called with
REG_STARTEND and a starting offset greater than zero. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1701 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog5
-rw-r--r--pcreposix.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d258b3..faba427 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,7 +45,10 @@ length incorrectly, which could result in buffer overflow.
11. Applied C++ patch from Irfan Adilovic to guard 'using std::' directives
with namespace pcrecpp (Bugzilla #2084).
-12. Remove a duplication typo in pcre_tables.c
+12. Remove a duplication typo in pcre_tables.c.
+
+13. Fix returned offsets from regexec() when REG_STARTEND is used with a
+starting offset greater than zero.
Version 8.40 11-January-2017
diff --git a/pcreposix.c b/pcreposix.c
index cf75588..7b404a7 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2016 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -389,8 +389,8 @@ if (rc >= 0)
{
for (i = 0; i < (size_t)rc; i++)
{
- pmatch[i].rm_so = ovector[i*2];
- pmatch[i].rm_eo = ovector[i*2+1];
+ pmatch[i].rm_so = ovector[i*2] + so;
+ pmatch[i].rm_eo = ovector[i*2+1] + so;
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;