git: 35245ed1786f - main - x11/quickshell: Fix a use-after-free in Hyprland IPC requests

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Fri, 09 Oct 2026 11:44:36 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=35245ed1786f5c705a583d1e85f453a19cf5eea3

commit 35245ed1786f5c705a583d1e85f453a19cf5eea3
Author:     Jordan Hubbard <jordanhubbard@gmail.com>
AuthorDate: 2026-10-09 11:41:32 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-10-09 11:41:32 +0000

    x11/quickshell: Fix a use-after-free in Hyprland IPC requests
    
    HyprlandIpc::makeRequest() deletes the request socket inside the
    socket's own readyRead handler, after which QIODevice touches the
    deleted object. With FreeBSD-CURRENT's malloc junk filling every
    Hyprland session crashes the shell with SIGBUS on its first
    request. Defer the deletion and disconnect the socket so the callback
    runs once.
    
    Closes: https://github.com/freebsd/freebsd-ports/pull/634
    
    Reported by:    Jordan Hubbard <jordanhubbard@gmail.com>
    Pull Request:   https://github.com/freebsd/freebsd-ports/pull/634
    Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
---
 x11/quickshell/Makefile                                  |  2 +-
 .../files/patch-src_wayland_hyprland_ipc_connection.cpp  | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/x11/quickshell/Makefile b/x11/quickshell/Makefile
index 82cf05517557..03d79bac134d 100644
--- a/x11/quickshell/Makefile
+++ b/x11/quickshell/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	quickshell
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.3.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	x11
 MASTER_SITES=	https://git.outfoxxed.me/${PORTNAME}/${PORTNAME}/archive/${DISTVERSIONFULL}${EXTRACT_SUFX}?dummy=/
 
diff --git a/x11/quickshell/files/patch-src_wayland_hyprland_ipc_connection.cpp b/x11/quickshell/files/patch-src_wayland_hyprland_ipc_connection.cpp
new file mode 100644
index 000000000000..6472a64dfb41
--- /dev/null
+++ b/x11/quickshell/files/patch-src_wayland_hyprland_ipc_connection.cpp
@@ -0,0 +1,16 @@
+--- src/wayland/hyprland/ipc/connection.cpp.orig	2026-08-21 02:28:55 UTC
++++ src/wayland/hyprland/ipc/connection.cpp
+@@ -177,8 +177,12 @@ void HyprlandIpc::makeRequest(
+ 	auto connectedCallback = [this, request, requestSocket, callback]() {
+ 		auto responseCallback = [requestSocket, callback]() {
+ 			auto response = requestSocket->readAll();
++			// Runs inside the socket's readyRead emission, after which QIODevice
++			// still touches the socket: defer deleting it, and stop further
++			// signals so the callback runs only once.
++			requestSocket->disconnect();
++			requestSocket->deleteLater();
+ 			callback(true, std::move(response));
+-			delete requestSocket;
+ 		};
+ 
+ 		QObject::connect(requestSocket, &QLocalSocket::readyRead, this, responseCallback);