summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2015-12-16 18:44:24 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2015-12-16 18:44:24 +0000
commite61a81509b63c2f19c80835abe575a480a4bb21f (patch)
tree7fa071fe38fe50c2f7be04a95160af833eae6d5d
parentda7e6199fe7a7f1cd41e35b2468768de61cc5c2b (diff)
downloadpcre2-e61a81509b63c2f19c80835abe575a480a4bb21f.tar.gz
Fix printing of *MARK names containing binary zeroes in pcre2test.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@469 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--ChangeLog6
-rw-r--r--src/pcre2test.c18
-rw-r--r--testdata/testinput214
-rw-r--r--testdata/testoutput222
4 files changed, 51 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index c650e8a..db52770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,8 @@
Change Log for PCRE2
--------------------
-Version 10.21 xx-xxx-xxxx
--------------------------
+Version 10.21-RC1 15-December-2015
+----------------------------------
1. Improve matching speed of patterns starting with + or * in JIT.
@@ -389,6 +389,8 @@ command line arguments.
112. Implemented PCRE2_SUBSTITUTE_UNKNOWN_UNSET and PCRE2_SUBSTITUTE_OVERFLOW_
LENGTH.
+113. Fix printing of *MARK names that contain binary zeroes in pcre2test.
+
Version 10.20 30-June-2015
--------------------------
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 85b3cff..93819f7 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -2545,13 +2545,14 @@ return (int)(pp - p);
*************************************************/
/* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given. If handed a NULL file,
+just counts chars without printing. */
static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f)
{
uint32_t c = 0;
int yield = 0;
-if (length < 0) length = strlen((char *)p);
+if (length < 0) length = p[-1];
while (length-- > 0)
{
if (utf)
@@ -2579,12 +2580,13 @@ return yield;
*************************************************/
/* Must handle UTF-16 strings in utf mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given. If handed a NULL file,
+just counts chars without printing. */
static int pchars16(PCRE2_SPTR16 p, int length, BOOL utf, FILE *f)
{
int yield = 0;
-if (length < 0) length = strlen16(p);
+if (length < 0) length = p[-1];
while (length-- > 0)
{
uint32_t c = *p++ & 0xffff;
@@ -2612,13 +2614,14 @@ return yield;
*************************************************/
/* Must handle UTF-32 strings in utf mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given.If handed a NULL file,
+just counts chars without printing. */
static int pchars32(PCRE2_SPTR32 p, int length, BOOL utf, FILE *f)
{
int yield = 0;
(void)(utf); /* Avoid compiler warning */
-if (length < 0) length = strlen32(p);
+if (length < 0) length = p[-1];
while (length-- > 0)
{
uint32_t c = *p++;
@@ -6402,7 +6405,8 @@ else for (gmatched = 0;; gmatched++)
TESTFLD(match_data, mark, !=, NULL))
{
fprintf(outfile, ", mark=");
- PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf, outfile);
+ PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf,
+ outfile);
rubriclength += 7;
}
fprintf(outfile, ": ");
diff --git a/testdata/testinput2 b/testdata/testinput2
index c06e440..071cca1 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4786,4 +4786,18 @@ a)"xI
\=offset_limit=1100000000000000000000
\=copy=11000000000
+/(*MARK:A\x00b)/mark
+ abc
+
+/(*MARK:A\x00b)/mark,alt_verbnames
+ abc
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+ abc
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+ abc
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 6dfd3ea..7178410 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -15136,4 +15136,26 @@ Failed: error -55 at offset 3 in replacement: requested value is not set
\=copy=11000000000
** Invalid value in 'copy=11000000000'
+/(*MARK:A\x00b)/mark
+ abc
+ 0:
+MK: A\x00b
+
+/(*MARK:A\x00b)/mark,alt_verbnames
+ abc
+ 0:
+MK: A\x00b
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+ abc
+ 0:
+MK: A\x00b
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+ abc
+ 0:
+MK: A\x00b
+
# End of testinput2