You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pcre2/SOURCES/pcre2-10.42-Match-also-rest...

62 lines
1.7 KiB

From 794245ecc296724b52f5030831e58bedbffa2452 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
Date: Tue, 3 Oct 2023 08:14:23 -0700
Subject: [PATCH] match: also restore originally unset entries in recursion
(#300)
A regresion from ~10.30 not affecting JIT
---
src/pcre2_match.c | 2 +-
testdata/testinput1 | 3 +++
testdata/testoutput1 | 7 +++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_match.c b/src/pcre2_match.c
index 5ce1792..8b57c75 100644
--- a/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -5953,7 +5953,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
{
P = (heapframe *)((char *)N - frame_size);
memcpy((char *)F + offsetof(heapframe, ovector), P->ovector,
- P->offset_top * sizeof(PCRE2_SIZE));
+ Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
Fcapture_last = P->capture_last;
Fcurrent_recurse = P->current_recurse;
diff --git a/testdata/testinput1 b/testdata/testinput1
index 062dfe0..3d75a35 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -4372,6 +4372,9 @@
/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
abcd
+/(?<all>(?:(?:a(?&all))|(b))(c?))/
+ aabc
+
/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
(?(DEFINE)
(?<NAME_PAT>[a-z]+)
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 1dc3b2f..26d3c83 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -6948,6 +6948,13 @@ No match
abcd
0: ab
+/(?<all>(?:(?:a(?&all))|(b))(c?))/
+ aabc
+ 0: aabc
+ 1: aabc
+ 2: <unset>
+ 3:
+
/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
(?(DEFINE)
(?<NAME_PAT>[a-z]+)
--
2.41.0