summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei Rybalkin <aleksei@rybalkin.org>2022-07-25 16:48:03 +0200
committerAleksei Rybalkin <aleksei@rybalkin.org>2022-07-25 16:48:03 +0200
commit6535c77b00a444750148d9d658e4d47214bb4562 (patch)
treeaa910a6a0ed90a94b46930dd98151576b34900a2
parent68a6628ffadddf08cb5374e8f71047bdaafcabe6 (diff)
downloadglib-6535c77b00a444750148d9d658e4d47214bb4562.tar.gz
gregex: do not set match and recursion limits on match context
These are not really necessary, and cause breakages (e.g. #2700). pcre2_set_recursion_limit is also deprecated. Fixes: #2700
-rw-r--r--glib/gregex.c2
-rw-r--r--glib/tests/regex.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/glib/gregex.c b/glib/gregex.c
index 6741d2479..dd61dc481 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -769,8 +769,6 @@ match_info_new (const GRegex *regex,
&match_info->n_subpatterns);
match_info->match_context = pcre2_match_context_create (NULL);
- pcre2_set_match_limit (match_info->match_context, 65536); /* should be plenty */
- pcre2_set_recursion_limit (match_info->match_context, 64); /* should be plenty */
if (is_dfa)
{
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index bb1a5ff76..5839465fa 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2493,6 +2493,9 @@ main (int argc, char *argv[])
TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "dž", -1, 0, 0, TRUE);
TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, TRUE);
+ /* see https://gitlab.gnome.org/GNOME/glib/-/issues/2700 */
+ TEST_MATCH("(\n.+)+", G_REGEX_DEFAULT, 0, "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n", -1, 0, 0, TRUE);
+
/* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */
TEST_MATCH_NEXT0("a", "x", -1, 0);
TEST_MATCH_NEXT0("a", "ax", -1, 1);