git: 1a37d438f0b4 - 2022Q3 - x11-wm/fvwm3: Avoid crash in FvwmIconMan
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Jul 2022 16:21:52 UTC
The branch 2022Q3 has been updated by cy:
URL: https://cgit.FreeBSD.org/ports/commit/?id=1a37d438f0b40c8a3dd5f098b7b8aac6ad378b1b
commit 1a37d438f0b40c8a3dd5f098b7b8aac6ad378b1b
Author: Felix Palmen <felix@palmen-it.de>
AuthorDate: 2022-07-18 23:20:36 +0000
Commit: Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-07-28 16:21:20 +0000
x11-wm/fvwm3: Avoid crash in FvwmIconMan
Add a patch working around the crash by initializing some struct member
to NULL that's otherwise used uninitialized and backporting some code
from upstream's main branch to correctly handle that case.
PR: 265291
(cherry picked from commit 1b4b3e9ce1e7255519f84324f3a7a4c1d7cd3f33)
---
x11-wm/fvwm3/Makefile | 2 +-
x11-wm/fvwm3/files/patch-pr265291 | 51 +++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/x11-wm/fvwm3/Makefile b/x11-wm/fvwm3/Makefile
index da33e0269296..dc76ee8c3a40 100644
--- a/x11-wm/fvwm3/Makefile
+++ b/x11-wm/fvwm3/Makefile
@@ -2,7 +2,7 @@
PORTNAME= fvwm3
PORTVERSION= 1.0.4
-PORTREVISION= 2
+PORTREVISION= 6
CATEGORIES= x11-wm
MASTER_SITES= https://github.com/fvwmorg/fvwm3/releases/download/${PORTVERSION}/ \
http://fvwm.sourceforge.net/generated/icon_download/:icons
diff --git a/x11-wm/fvwm3/files/patch-pr265291 b/x11-wm/fvwm3/files/patch-pr265291
new file mode 100644
index 000000000000..59fa97e71389
--- /dev/null
+++ b/x11-wm/fvwm3/files/patch-pr265291
@@ -0,0 +1,51 @@
+Avoid a crash caused by UB (use of uninitialized value).
+
+Initialize a value to NULL and backport code handling this case from main.
+This won't hurt and avoids the crash, although it's probably not the correct
+fix.
+
+Upstream issue: https://github.com/fvwmorg/fvwm3/issues/659
+
+--- modules/FvwmIconMan/x.c.orig 2022-07-18 23:18:50 UTC
++++ modules/FvwmIconMan/x.c
+@@ -742,6 +742,7 @@ void X_init_manager (int man_id)
+ char *scr;
+ fscreen_scr_arg arg;
+ arg.mouse_ev = NULL;
++ arg.name = NULL;
+
+ geometry_mask = FScreenParseGeometryWithScreen(
+ man->geometry_str, &man->geometry.x, &man->geometry.y,
+--- libs/FScreen.c.orig 2022-07-21 10:39:30 UTC
++++ libs/FScreen.c
+@@ -186,6 +186,11 @@ monitor_resolve_name(const char *scr)
+ {
+ struct monitor *m = NULL;
+
++ if (scr == NULL)
++ {
++ return NULL;
++ }
++
+ /* Assume the monitor name is a literal RandR name (such as HDMI2) and
+ * look it up regardless.
+ */
+@@ -698,11 +703,14 @@ FindScreen(fscreen_scr_arg *arg, fscreen_scr_t screen)
+ m = FindScreenOfXY(arg->xypos.x, arg->xypos.y);
+ break;
+ case FSCREEN_BY_NAME:
+- if (arg == NULL || arg->name == NULL) {
+- /* XXX: Work out what to do. */
+- break;
++ if (arg == NULL || arg->name == NULL)
++ {
++ m = monitor_by_primary();
+ }
+- m = monitor_resolve_name(arg->name);
++ else
++ {
++ m = monitor_resolve_name(arg->name);
++ }
+ break;
+ default:
+ /* XXX: Possible error condition here? */