Revision: 404
http://www.exim.org/viewvc/pcre2?view=rev&revision=404
Author: ph10
Date: 2015-11-01 16:28:13 +0000 (Sun, 01 Nov 2015)
Log Message:
-----------
Fix VERSION condition bug.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/doc/pcre2pattern.3
code/trunk/src/pcre2_compile.c
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput2
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2015-10-30 18:30:43 UTC (rev 403)
+++ code/trunk/ChangeLog 2015-11-01 16:28:13 UTC (rev 404)
@@ -240,7 +240,12 @@
pcre2_substitute(). An added check for a number greater than the largest group
number in the pattern means this is not now needed.
+70. The PCRE2-specific VERSION condition didn't work correctly if only one
+digit was given after the decimal point, or if more than two digits were given.
+It now works with one or two digits, and gives a compile time error if more are
+given.
+
Version 10.20 30-June-2015
--------------------------
Modified: code/trunk/doc/pcre2pattern.3
===================================================================
--- code/trunk/doc/pcre2pattern.3 2015-10-30 18:30:43 UTC (rev 403)
+++ code/trunk/doc/pcre2pattern.3 2015-11-01 16:28:13 UTC (rev 404)
@@ -1,4 +1,4 @@
-.TH PCRE2PATTERN 3 "16 October 2015" "PCRE2 10.21"
+.TH PCRE2PATTERN 3 "01 November 2015" "PCRE2 10.21"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH "PCRE2 REGULAR EXPRESSION DETAILS"
@@ -2534,7 +2534,8 @@
(?(VERSION>=10.4)yes|no)
.sp
This pattern matches "yes" if the PCRE2 version is greater or equal to 10.4, or
-"no" otherwise.
+"no" otherwise. The fractional part of the version number may not contain more
+than two digits.
.
.
.SS "Assertion conditions"
@@ -3392,6 +3393,6 @@
.rs
.sp
.nf
-Last updated: 16 October 2015
+Last updated: 01 November 2015
Copyright (c) 1997-2015 University of Cambridge.
.fi
Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c 2015-10-30 18:30:43 UTC (rev 403)
+++ code/trunk/src/pcre2_compile.c 2015-11-01 16:28:13 UTC (rev 404)
@@ -3731,7 +3731,7 @@
if (code > cb->start_workspace + cb->workspace_size -
WORK_SIZE_SAFETY_MARGIN) /* Check for overrun */
{
- *errorcodeptr = (code >= cb->start_workspace + cb->workspace_size)?
+ *errorcodeptr = (code >= cb->start_workspace + cb->workspace_size)?
ERR52 : ERR86;
goto FAILED;
}
@@ -5885,9 +5885,10 @@
{
ptr++;
while (IS_DIGIT(*ptr)) minor = minor * 10 + *ptr++ - '0';
+ if (minor < 10) minor *= 10;
}
- if (*ptr != CHAR_RIGHT_PARENTHESIS)
+ if (*ptr != CHAR_RIGHT_PARENTHESIS || minor > 99)
{
*errorcodeptr = ERR79;
goto FAILED;
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2015-10-30 18:30:43 UTC (rev 403)
+++ code/trunk/testdata/testinput2 2015-11-01 16:28:13 UTC (rev 404)
@@ -4018,6 +4018,8 @@
/(?(VERSION>=10.0.0)yes|no)/
+/(?(VERSION=10.101)yes|no)/
+
/abcd/I
/abcd/I,no_start_optimize
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2015-10-30 18:30:43 UTC (rev 403)
+++ code/trunk/testdata/testoutput2 2015-11-01 16:28:13 UTC (rev 404)
@@ -13386,6 +13386,9 @@
/(?(VERSION>=10.0.0)yes|no)/
Failed: error 179 at offset 16: syntax error in (?(VERSION condition
+/(?(VERSION=10.101)yes|no)/
+Failed: error 179 at offset 17: syntax error in (?(VERSION condition
+
/abcd/I
Capturing subpattern count = 0
First code unit = 'a'