Skip to content

Commit

Permalink
Fix POSIX API bug when REG_STARTEND is used with a non-zero starting …
Browse files Browse the repository at this point in the history
…offset and

there are unset groups within the matching group list.


git-svn-id: svn:https://vcs.exim.org/pcre/code/trunk@1724 2f5784b3-3f2a-0410-8824-cb99058d5e15
  • Loading branch information
ph10 committed Feb 19, 2018
1 parent 4ffc344 commit 8dc7206
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ChangeLog for PCRE
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.

Version 8.42 xx-xxx-2017
Version 8.42 xx-xxx-2018
------------------------

1. Fixed a MIPS issue in the JIT compiler reported by Joshua Kinard.
Expand Down Expand Up @@ -39,6 +39,11 @@ as the first character of a match.
8. Fix out-of-bounds read for partial matching of /./ against an empty string
when the newline type is CRLF.

9. When matching using the the REG_STARTEND feature of the POSIX API with a
non-zero starting offset, unset capturing groups with lower numbers than a
group that did capture something were not being correctly returned as "unset"
(that is, with offset values of -1).


Version 8.41 05-July-2017
-------------------------
Expand Down
6 changes: 3 additions & 3 deletions pcreposix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8dc7206

Please sign in to comment.