[Pcre-svn] [451] code/trunk: Give error for regexec with pma…

Inizio della pagina
Delete this message
Autore: Subversion repository
Data:  
To: pcre-svn
Oggetto: [Pcre-svn] [451] code/trunk: Give error for regexec with pmatch= NULL and REG_STARTEND set.
Revision: 451
          http://www.exim.org/viewvc/pcre2?view=rev&revision=451
Author:   ph10
Date:     2015-11-29 17:38:12 +0000 (Sun, 29 Nov 2015)
Log Message:
-----------
Give error for regexec with pmatch=NULL and REG_STARTEND set.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/doc/pcre2posix.3
    code/trunk/src/pcre2posix.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-11-27 17:34:36 UTC (rev 450)
+++ code/trunk/ChangeLog    2015-11-29 17:38:12 UTC (rev 451)
@@ -344,7 +344,10 @@
 qualifier when PCRE2_AUTO_CALLOUT was set, pcre2_compile() misbehaved. This bug
 was found by the LLVM fuzzer.


+103. The POSIX wrapper function regexec() crashed if the option REG_STARTEND
+was set when the pmatch argument was NULL. It now returns REG_INVARG.

+
Version 10.20 30-June-2015
--------------------------


Modified: code/trunk/doc/pcre2posix.3
===================================================================
--- code/trunk/doc/pcre2posix.3    2015-11-27 17:34:36 UTC (rev 450)
+++ code/trunk/doc/pcre2posix.3    2015-11-29 17:38:12 UTC (rev 451)
@@ -1,4 +1,4 @@
-.TH PCRE2POSIX 3 "30 October 2015" "PCRE2 10.21"
+.TH PCRE2POSIX 3 "29 November 2015" "PCRE2 10.21"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "SYNOPSIS"
@@ -211,7 +211,8 @@
 IEEE Standard 1003.2 (POSIX.2), and should be used with caution in software
 intended to be portable to other systems. Note that a non-zero \fIrm_so\fP does
 not imply REG_NOTBOL; REG_STARTEND affects only the location of the string, not
-how it is matched.
+how it is matched. Setting REG_STARTEND and passing \fIpmatch\fP as NULL are 
+mutually exclusive; the error REG_INVARG is returned.
 .P
 If the pattern was compiled with the REG_NOSUB flag, no data about any matched
 strings is returned. The \fInmatch\fP and \fIpmatch\fP arguments of
@@ -269,6 +270,6 @@
 .rs
 .sp
 .nf
-Last updated: 30 October 2015
+Last updated: 29 November 2015
 Copyright (c) 1997-2015 University of Cambridge.
 .fi


Modified: code/trunk/src/pcre2posix.c
===================================================================
--- code/trunk/src/pcre2posix.c    2015-11-27 17:34:36 UTC (rev 450)
+++ code/trunk/src/pcre2posix.c    2015-11-29 17:38:12 UTC (rev 451)
@@ -285,6 +285,7 @@


if ((eflags & REG_STARTEND) != 0)
{
+ if (pmatch == NULL) return REG_INVARG;
so = pmatch[0].rm_so;
eo = pmatch[0].rm_eo;
}