summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-10-31 07:02:57 -0400
committerMatthias Clasen <mclasen@redhat.com>2016-10-31 07:02:57 -0400
commit8378c4f6e14b04b0a4a45d5efca2de290cf66e1a (patch)
tree6d735cfe1b7ea39016dd93db62e1e8433671746f
parentfbf663ac9179ba308fd91f593c8f00794006a2a9 (diff)
downloadflatpak-8378c4f6e14b04b0a4a45d5efca2de290cf66e1a.tar.gz
Avoid a crash during update --appstreamappstream-crash
It turns out that flatpak_dir_remote_fetch_summary can return TRUE, yet leave summary_bytes NULL. The code further down does not deal gracefully with summary_bytes being NULL, so error out early instead of crashing.
-rw-r--r--common/flatpak-dir.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index f1b71543..e89aae1c 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -1600,6 +1600,13 @@ flatpak_dir_pull (FlatpakDir *self,
cancellable, error))
return FALSE;
+ if (summary_bytes == NULL)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to get repository summary");
+ return FALSE;
+ }
+
summary = g_variant_ref_sink (g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
summary_bytes, FALSE));
if (!flatpak_summary_lookup_ref (summary,