Resolved: #2151344 SEGV with portal_context->owner in name_owner_changed()

This commit is contained in:
Takao Fujiwara 2022-12-07 11:49:13 +09:00
parent f955cf1ac5
commit 2b70348bb7
2 changed files with 45 additions and 8 deletions

View File

@ -1,6 +1,6 @@
From f6d31621404dc8716bddd0588402fbdde4f5fb73 Mon Sep 17 00:00:00 2001
From eb9eaa6b52d5beb4aff0a45dcd2b97a4071029ea Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 3 Nov 2022 08:59:41 +0900
Date: Wed, 7 Dec 2022 11:11:09 +0900
Subject: [PATCH] Fix SEGV in bus_panel_proxy_focus_in()
rhbz#1350291 SEGV in BUS_IS_CONNECTION(skip_connection) in
@ -32,6 +32,9 @@ events and m_loop was not released.
rhbz#1797120 SEGV in assert(bus.is_connected()) in panel_binding_construct()
Check m_ibus in extension.vala:bus_name_acquired_cb()
rhbz#2151344 SEGV with portal_context->owner in name_owner_changed()
Maybe g_object_unref() is called but not finalzed yet.
BUG=rhbz#1350291
BUG=rhbz#1601577
BUG=rhbz#1663528
@ -40,14 +43,16 @@ BUG=rhbz#1795499
BUG=rhbz#1771238
BUG=rhbz#1767976
BUG=rhbz#1797120
BUG=rhbz#2151344
---
bus/dbusimpl.c | 47 ++++++++++++++++++++++++---
bus/engineproxy.c | 44 +++++++++++++++++++------
client/x11/main.c | 8 ++++-
portal/portal.c | 11 +++++++
src/ibusbus.c | 6 ++++
ui/gtk3/extension.vala | 4 +++
ui/gtk3/switcher.vala | 73 +++++++++++++++++++++++++-----------------
6 files changed, 137 insertions(+), 45 deletions(-)
7 files changed, 148 insertions(+), 45 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index 59787a80..af2fbde2 100644
@ -238,7 +243,7 @@ index fd1f34fb..57c061ba 100644
/* FIXME: set destroy callback ? */
g_task_return_pointer (data->task, engine, NULL);
diff --git a/client/x11/main.c b/client/x11/main.c
index 6057cc03..12e9012c 100644
index 905fd251..1abea0af 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -45,6 +45,7 @@
@ -249,7 +254,7 @@ index 6057cc03..12e9012c 100644
#include <getopt.h>
@@ -1148,7 +1149,12 @@ _atexit_cb ()
@@ -1269,7 +1270,12 @@ _atexit_cb ()
static void
_sighandler (int sig)
{
@ -263,6 +268,35 @@ index 6057cc03..12e9012c 100644
}
static void
diff --git a/portal/portal.c b/portal/portal.c
index c2e4fc7f..a347fe6a 100644
--- a/portal/portal.c
+++ b/portal/portal.c
@@ -90,6 +90,11 @@ static void portal_context_g_signal (GDBusProxy *proxy,
GVariant *parameters,
IBusPortalContext *portal_context);
+#define IBUS_TYPE_PORTAL_CONTEXT \
+ (ibus_portal_context_get_type ())
+#define IBUS_IS_PORTAL_CONTEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PORTAL_CONTEXT))
+
G_DEFINE_TYPE_WITH_CODE (IBusPortalContext,
ibus_portal_context,
IBUS_DBUS_TYPE_INPUT_CONTEXT_SKELETON,
@@ -624,6 +629,12 @@ name_owner_changed (GDBusConnection *connection,
IBusPortalContext *portal_context = l->data;
next = l->next;
+ /* rhbz#2151344 portal_context might not be finalized? */
+ if (!G_LIKELY (IBUS_IS_PORTAL_CONTEXT (portal_context))) {
+ g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC,
+ "portal_context is not IBusPortalContext");
+ continue;
+ }
if (g_strcmp0 (portal_context->owner, name) == 0) {
g_object_unref (portal_context);
}
diff --git a/src/ibusbus.c b/src/ibusbus.c
index 47400cb8..c9fbe492 100644
--- a/src/ibusbus.c
@ -400,5 +434,5 @@ index 9400e9ba..2ecbdac1 100644
#if VALA_0_34
seat.ungrab();
--
2.37.3
2.38.1

View File

@ -39,7 +39,7 @@
Name: ibus
Version: 1.5.27
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.0-or-later
URL: https://github.com/ibus/%name/wiki
@ -523,8 +523,11 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Wed Dec 07 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-8
- Resolved: #2151344 SEGV with portal_context->owner in name_owner_changed()
* Fri Dec 02 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-7
- Add GitHub action patches
- Add GitHub action patches
* Thu Nov 24 2022 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.27-6
- Implement new process_key_event for ibus-x11