public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/glib2] cve-2026-58016-f44: Backport another GRegex upstream fix
@ 2026-08-11 10:37 Kalev Lember
  0 siblings, 0 replies; only message in thread
From: Kalev Lember @ 2026-08-11 10:37 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/glib2
            Branch : cve-2026-58016-f44
            Commit : 17a834805e1ed93c7a1caf3cc0aa7b6e8fe6012b
            Author : Kalev Lember <klember@redhat.com>
            Date   : 2022-07-27T12:36:53+02:00
            Stats  : +72/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/glib2/c/17a834805e1ed93c7a1caf3cc0aa7b6e8fe6012b?branch=cve-2026-58016-f44

            Log:
            Backport another GRegex upstream fix

Thanks again to Mamoru TASAKA <mtasaka@fedoraproject.org>!

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2838

---
diff --git a/2838.patch b/2838.patch
new file mode 100644
index 0000000..c7ea061
--- /dev/null
+++ b/2838.patch
@@ -0,0 +1,70 @@
+From 6535c77b00a444750148d9d658e4d47214bb4562 Mon Sep 17 00:00:00 2001
+From: Aleksei Rybalkin <aleksei@rybalkin.org>
+Date: Mon, 25 Jul 2022 16:48:03 +0200
+Subject: [PATCH 1/2] 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
+---
+ glib/gregex.c      | 2 --
+ glib/tests/regex.c | 3 +++
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/glib/gregex.c b/glib/gregex.c
+index 6741d2479f..dd61dc4813 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 bb1a5ff762..5839465fae 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);
+-- 
+GitLab
+
+
+From a2b5b9e906256f43b0bac702424613ea0e7ddcb0 Mon Sep 17 00:00:00 2001
+From: Aleksei Rybalkin <aleksei@rybalkin.org>
+Date: Mon, 25 Jul 2022 16:57:06 +0200
+Subject: [PATCH 2/2] gregex: add original test case for issue #2700
+
+---
+ glib/tests/regex.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/glib/tests/regex.c b/glib/tests/regex.c
+index 5839465fae..acb082b704 100644
+--- a/glib/tests/regex.c
++++ b/glib/tests/regex.c
+@@ -2495,6 +2495,7 @@ main (int argc, char *argv[])
+ 
+   /* 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("\n([\\-\\.a-zA-Z]+[\\-\\.0-9]*) +connected ([^(\n ]*)[^\n]*((\n +[0-9]+x[0-9]+[^\n]+)+)", G_REGEX_DEFAULT, 0, "Screen 0: minimum 1 x 1, current 3840 x 1080, maximum 8192 x 8192\nVirtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm\n   1920x1080     60.00*+  59.96  \n   3840x2400     59.97  \n   3840x2160     59.97  \n   2880x1800     59.95  \n   2560x1600     59.99  \n   2560x1440     59.95  \n   1920x1440     60.00  \n   1856x1392     60.00  \n   1792x1344     60.00  \n   1920x1200     59.88  \n   1600x1200     60.00  \n   1680x1050     59.95  \n   1400x1050     59.98  \n   1280x1024     60.02  \n   1440x900      59.89  \n   1280x960      60.00  \n   1360x768      60.02  \n   1280x800      59.81  \n   1152x864      75.00  \n   1280x768      59.87  \n   1280x720      59.86  \n   1024x768      60.00  \n   800x600       60.32  \n   640x480       59.94  \nVirtual2 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 0mm x 0mm\n   1920x1080     60.00*+  59.96  \n   3840x2400     59.97  \n   3840x2160     59.97  \n   2880x1800     59.95  \n   2560x1600     59.99  \n   2560x1440     59.95  \n   1920x1440     60.00  \n   1856x1392     60.00  \n   1792x1344     60.00  \n   1920x1200     59.88  \n   1600x1200     60.00  \n   1680x1050     59.95  \n   1400x1050     59.98  \n   1280x1024     60.02  \n   1440x900      59.89  \n   1280x960      60.00  \n   1360x768      60.02  \n   1280x800      59.81  \n   1152x864      75.00  \n   1280x768      59.87  \n   1280x720      59.86  \n   1024x768      60.00  \n   800x600       60.32  \n   640x480       59.94  \nVirtual3 disconnected (normal left inverted right x axis y axis)\nVirtual4 disconnected (normal left inverted right x axis y axis)\nVirtual5 disconnected (normal left inverted right x axis y axis)\nVirtual6 disconnected (normal left inverted right x axis y axis)\nVirtual7 disconnected (normal left inverted right x axis y axis)\nVirtual8 disconnected (normal left inverted right x axis y axis)\n", -1, 0, 0, TRUE);
+ 
+   /* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */
+   TEST_MATCH_NEXT0("a", "x", -1, 0);
+-- 
+GitLab
+

diff --git a/glib2.spec b/glib2.spec
index d3d3b0c..6e11ba6 100644
--- a/glib2.spec
+++ b/glib2.spec
@@ -20,6 +20,8 @@ Patch1: gdesktopappinfo.patch
 # Backported from upstream to fix GRegex on s390x
 # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2840
 Patch2: 2840.patch
+# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2838
+Patch3: 2838.patch
 
 BuildRequires: gcc
 BuildRequires: gcc-c++

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-11 10:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-11 10:37 [rpms/glib2] cve-2026-58016-f44: Backport another GRegex upstream fix Kalev Lember

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox