Notification time stamped 2021-11-01 06:17:17 UTC
From 60d8fded7520ae0ac4f040a7a4d7643454a84e45 Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka(a)fedoraproject.org>
Date: Nov 01 2021 06:17:08 +0000
Subject: get_egl_config: reset loop counter with prefersGLSL option each loop
(ref: bug 1983483)
---
diff --git
a/xscreensaver-6.02-0002-get_egl_config-reset-loop-counter-with-prefersGLSL-o.patch
b/xscreensaver-6.02-0002-get_egl_config-reset-loop-counter-with-prefersGLSL-o.patch
new file mode 100644
index 0000000..bce3f3f
--- /dev/null
+++ b/xscreensaver-6.02-0002-get_egl_config-reset-loop-counter-with-prefersGLSL-o.patch
@@ -0,0 +1,55 @@
+From 821b20c2e6f64191525cef9dce715ac31a8e8652 Mon Sep 17 00:00:00 2001
+From: Mamoru TASAKA <mtasaka(a)fedoraproject.org>
+Date: Mon, 1 Nov 2021 10:29:45 +0900
+Subject: [PATCH] get_egl_config: reset loop counter with prefersGLSL option
+ each loop
+
+Some GL hacks (like sphereeversion) calls get_egl_config with option
+"prefersGLSL" on. With this mode, "iter" is set as 2, and
"pass" loop
+in get_egl_config runs twice.
+However, "i" is initialized only outside "pass" loop, so on the
second
+"pass" loop, "i" is already at the max value, and second
"pass" loop
+actually does nothing.
+
+As the consequence, if the driver cannot support EGL_OPENGL_ES3_BIT,
+get_egl_config() cannot find any config even if the driver support
+EGL_OPENGL_ES_BIT, then hacks abort().
+
+The fix for this is to re-initialize "i" value for each "pass" loop.
+---
+ utils/visual-gl.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/utils/visual-gl.c b/utils/visual-gl.c
+index cca4ecf..112e4c1 100644
+--- a/utils/visual-gl.c
++++ b/utils/visual-gl.c
+@@ -230,13 +230,13 @@ get_egl_config (Display *dpy, EGLDisplay *egl_display,
+ };
+ EGLint attrs[40];
+ EGLint nconfig;
+- int i, j, k, iter, pass;
++ int i, i_start, j, k, iter, pass;
+ Bool glslp;
+
+- i = 0;
++ i_start = 0;
+ # ifdef SB
+ if (! get_boolean_resource (dpy, "multiSample", "MultiSample"))
+- i = SB_COUNT; /* skip over the multibuffer entries in 'attrs' */
++ i_start = SB_COUNT; /* skip over the multibuffer entries in 'attrs' */
+ # endif /* SB */
+
+ glslp = get_boolean_resource (dpy, "prefersGLSL", "PrefersGLSL");
+@@ -245,7 +245,7 @@ get_egl_config (Display *dpy, EGLDisplay *egl_display,
+ *egl_config = 0;
+ for (pass = 0; pass < iter; pass++)
+ {
+- for (; i < countof(templates); i++)
++ for (i = i_start ; i < countof(templates); i++)
+ {
+ for (j = 0, k = 0; templates[i][j] != EGL_NONE; j += 2)
+ {
+--
+2.33.1
+
diff --git a/xscreensaver.spec b/xscreensaver.spec
index f56da8f..f8149c7 100644
--- a/xscreensaver.spec
+++ b/xscreensaver.spec
@@ -11,7 +11,7 @@
%define split_getimage 1
%endif
-%define fedora_rel 2
+%define fedora_rel 3
%global use_clang_as_cc 0
%global use_clang_analyze 0
@@ -96,6 +96,8 @@ Patch3607:
xscreensaver-5.36-0007-misc-kill-gcc-warn_unused_result-warning
# Patch to be sent to the upstream
# xscreensaver_systemd_loop: avoid use-after-free on for_each loop
Patch5201:
xscreensaver-6.02-0001-xscreensaver_systemd_loop-avoid-use-after-free-on-fo.patch
+# get_egl_config: reset loop counter with prefersGLSL option each loop
+Patch5202:
xscreensaver-6.02-0002-get_egl_config-reset-loop-counter-with-prefersGLSL-o.patch
# Fedora specific
# window_init: search parenthesis first for searching year
Patch10001:
xscreensaver-6.00-0001-screensaver_id-search-parenthesis-first-for-searchin.patch
@@ -377,6 +379,7 @@ find . -name \*.c -exec chmod ugo-x {} \;
#%%__cat %PATCH3607 | %__git am
%__cat %PATCH5201 | %__git am
+%__cat %PATCH5202 | %__git am
%__cat %PATCH10001 | %__git am
%__cat %PATCH10003 | %__git am
%__cat %PATCH10005 | %__git am
@@ -1126,6 +1129,10 @@ exit 0
%endif
%changelog
+* Mon Nov 1 2021 Mamoru TASAKA <mtasaka(a)fedoraproject.org> - 1:6.02-3
+- get_egl_config: reset loop counter with prefersGLSL option each loop
+ (ref: bug 1983483)
+
* Sun Oct 17 2021 Mamoru TASAKA <mtasaka(a)fedoraproject.org> - 1:6.02-2
- xscreensaver_systemd_loop: avoid use-after-free on for_each loop
https://src.fedoraproject.org/rpms/xscreensaver/c/60d8fded7520ae0ac4f040a...