summaryrefslogtreecommitdiff
path: root/pcreposix.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-02-19 16:35:05 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2018-02-19 16:35:05 +0000
commit8dc7206187ef9e9486fb5f102b85400ae9795dd1 (patch)
tree8ea9ee26ffcc2440ba770c4eb91662812725d733 /pcreposix.c
parent4ffc344ddf6246bf8d19c94c58af0853ae6768a7 (diff)
downloadpcre-8dc7206187ef9e9486fb5f102b85400ae9795dd1.tar.gz
Fix POSIX API bug when REG_STARTEND is used with a non-zero starting offset and
there are unset groups within the matching group list. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1724 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcreposix.c')
-rw-r--r--pcreposix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pcreposix.c b/pcreposix.c
index 7b404a7..a76d6bf 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-2017 University of Cambridge
+ Copyright (c) 1997-2018 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] + so;
- pmatch[i].rm_eo = ovector[i*2+1] + so;
+ pmatch[i].rm_so = (ovector[i*2] < 0)? -1 : ovector[i*2] + so;
+ pmatch[i].rm_eo = (ovector[i*2+1] < 0)? -1: ovector[i*2+1] + so;
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;