Backport a fix for a gnome-software crash installing .flatpakref files

This commit is contained in:
Kalev Lember 2018-05-02 10:29:23 +02:00
parent c50286f8d7
commit 14c8c6d878
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 72cad276323914503c3271aa0670d309c1124125 Mon Sep 17 00:00:00 2001
From: Matthew Leeds <matthew.leeds@endlessm.com>
Date: Tue, 1 May 2018 09:18:03 -0700
Subject: [PATCH] lib: Don't try to use a NULL FlatpakRemoteState
In flatpak_remote_ref_new(), the state parameter is optional, so check
if it's NULL before trying to use it in
flatpak_remote_state_lookup_sparse_cache(). This prevents a seg fault
when GNOME Software is installing a .flatpakref file.
Fixes https://github.com/flatpak/flatpak/issues/1632
Closes: #1635
Approved by: pwithnall
---
lib/flatpak-remote-ref.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/flatpak-remote-ref.c b/lib/flatpak-remote-ref.c
index 0a4c1e4d..3573fa6d 100644
--- a/lib/flatpak-remote-ref.c
+++ b/lib/flatpak-remote-ref.c
@@ -350,7 +350,9 @@ flatpak_remote_ref_new (FlatpakCollectionRef *coll_ref,
if (metadata)
metadata_bytes = g_bytes_new (metadata, strlen (metadata));
- sparse = flatpak_remote_state_lookup_sparse_cache (state, full_ref, NULL);
+ if (state)
+ sparse = flatpak_remote_state_lookup_sparse_cache (state, full_ref, NULL);
+
if (sparse)
{
g_variant_lookup (sparse, "eol", "&s", &eol);
--
2.17.0

View File

@ -3,13 +3,15 @@
Name: flatpak Name: flatpak
Version: 0.11.5 Version: 0.11.5
Release: 1%{?dist} Release: 2%{?dist}
Summary: Application deployment framework for desktop apps Summary: Application deployment framework for desktop apps
License: LGPLv2+ License: LGPLv2+
URL: http://flatpak.org/ URL: http://flatpak.org/
Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/%{name}-%{version}.tar.xz Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/%{name}-%{version}.tar.xz
Patch0: 0001-lib-Don-t-try-to-use-a-NULL-FlatpakRemoteState.patch
BuildRequires: pkgconfig(appstream-glib) BuildRequires: pkgconfig(appstream-glib)
BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.40.0 BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.40.0
@ -148,6 +150,9 @@ flatpak remote-list --system &> /dev/null || :
%changelog %changelog
* Wed May 02 2018 Kalev Lember <klember@redhat.com> - 0.11.5-2
- Backport a fix for a gnome-software crash installing .flatpakref files
* Mon Apr 30 2018 David King <amigadave@amigadave.com> - 0.11.5-1 * Mon Apr 30 2018 David King <amigadave@amigadave.com> - 0.11.5-1
- Update to 0.11.5 - Update to 0.11.5