[gnome-software: 1/3] Fix crash loading empty DEP-11 data.
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/3] Fix crash loading empty DEP-11 data.
- Date: Tue, 25 May 2021 08:49:17 +0000 (UTC)
commit aa9a87d65b143611ab4201f885e4bafcb4147a8f
Author: Robert Ancell <robert ancell canonical com>
Date: Mon May 24 12:43:59 2021 +1200
Fix crash loading empty DEP-11 data.
as_metadata_components_to_collection returns NULL if there is nothing to serialize, and also if an error
occurs.
Add a check to detect the former case instead of attempting to read an unset GError.
plugins/core/gs-plugin-appstream.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index e353fa45e..a013711c0 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -346,9 +346,16 @@ gs_plugin_appstream_load_dep11_cb (XbBuilderSource *self,
return NULL;
}
- xml = as_metadata_components_to_collection (mdata, AS_FORMAT_KIND_XML, error);
- if (xml == NULL)
- return NULL;
+ xml = as_metadata_components_to_collection (mdata, AS_FORMAT_KIND_XML, &tmp_error);
+ if (xml == NULL) {
+ if (tmp_error != NULL) {
+ g_propagate_error (error, g_steal_pointer (&tmp_error));
+ return NULL;
+ }
+
+ xml = g_strdup("");
+ }
+
return g_memory_input_stream_new_from_data (g_steal_pointer (&xml), -1, g_free);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]