summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-11-23 14:22:07 -0600
committerJan-Michael Brummer <jan.brummer@tabos.org>2020-11-28 20:18:48 +0000
commit3829d5687af829ef2e6ade8c77061ba052a2918a (patch)
tree7ac1b5c1ccb1c12a9984b7ab4d8623dae163134f
parent164dd9a7cb1597eca3aede948d85cb489a0630eb (diff)
downloadepiphany-3829d5687af829ef2e6ade8c77061ba052a2918a.tar.gz
gsb-service: don't crash when GSB database is brokenmcatanzaro/1900656
Currently there are four places where we assert the GSB database is not broken. But some of these asserts are wrong. Two are clearly safe, and one is clearly not (since it was actually hit). I think the other is also not safe. https://bugzilla.redhat.com/show_bug.cgi?id=1900656
-rw-r--r--lib/safe-browsing/ephy-gsb-service.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/safe-browsing/ephy-gsb-service.c b/lib/safe-browsing/ephy-gsb-service.c
index 795049a3f..44c244f4c 100644
--- a/lib/safe-browsing/ephy-gsb-service.c
+++ b/lib/safe-browsing/ephy-gsb-service.c
@@ -141,7 +141,12 @@ ephy_gsb_service_schedule_update (EphyGSBService *self)
gint64 interval;
g_assert (EPHY_IS_GSB_SERVICE (self));
- g_assert (ephy_gsb_storage_is_operable (self->storage));
+
+ if (!ephy_gsb_storage_is_operable (self->storage)) {
+ self->source_id = 0;
+ LOG ("Local GSB database is broken, cannot schedule update");
+ return;
+ }
/* This function should only be called when self->next_list_updates_time is
* greater than CURRENT_TIME. However, asserting (self->next_list_updates_time
@@ -178,7 +183,11 @@ ephy_gsb_service_update_thread (GTask *task,
char *body;
g_assert (EPHY_IS_GSB_SERVICE (self));
- g_assert (ephy_gsb_storage_is_operable (self->storage));
+
+ if (!ephy_gsb_storage_is_operable (self->storage)) {
+ LOG ("Local GSB database is broken, cannot update it");
+ goto out;
+ }
/* Set up a default next update time in case of failure or non-existent
* minimum wait duration.