[gnome-software/gnome-3-26] Do not crash when a plugin adds an app with NULL id
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-26] Do not crash when a plugin adds an app with NULL id
- Date: Mon, 8 Jan 2018 20:30:57 +0000 (UTC)
commit 969c6e5487b398c2f7c1fb8c8a3437e5c365810d
Author: Kalev Lember <klember redhat com>
Date: Tue Jan 2 22:17:49 2018 +0100
Do not crash when a plugin adds an app with NULL id
https://retrace.fedoraproject.org/faf/problems/3188252/ points to the
direction of the fwupd plugin: it is passing a NULL id to
gs_plugin_cache_add, which leads to a crash GHashTable code, trying to
g_str_hash the NULL string.
This commit adds a missing g_return_if_fail to gs_plugin_cache_add to
guard against that. We should figure out what's wrong in the fwupd
plugin, but this should at least fix the user facing crash in the mean
time.
lib/gs-plugin.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index d844c46..f354022 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1540,6 +1540,8 @@ gs_plugin_cache_add (GsPlugin *plugin, const gchar *key, GsApp *app)
if (key == NULL)
key = gs_app_get_unique_id (app);
+ g_return_if_fail (key != NULL);
+
/* global, so using internal unique_id */
if (gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_GLOBAL_CACHE)) {
if (!as_utils_unique_id_valid (key)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]