[Pcre-svn] [1701] code/trunk: Fix matching offsets from rege…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1701] code/trunk: Fix matching offsets from regexec() in the POSIX wrapper when called with
Revision: 1701
          http://vcs.pcre.org/viewvc?view=rev&revision=1701
Author:   ph10
Date:     2017-06-03 17:47:21 +0100 (Sat, 03 Jun 2017)
Log Message:
-----------
Fix matching offsets from regexec() in the POSIX wrapper when called with 
REG_STARTEND and a starting offset greater than zero. 


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcreposix.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2017-05-07 07:28:03 UTC (rev 1700)
+++ code/trunk/ChangeLog    2017-06-03 16:47:21 UTC (rev 1701)
@@ -45,9 +45,12 @@
 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
----------------------------


Modified: code/trunk/pcreposix.c
===================================================================
--- code/trunk/pcreposix.c    2017-05-07 07:28:03 UTC (rev 1700)
+++ code/trunk/pcreposix.c    2017-06-03 16:47:21 UTC (rev 1701)
@@ -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 @@
     {
     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;